Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error computing predicted values #56

Closed
elslabbert opened this issue Jul 28, 2020 · 4 comments
Closed

Error computing predicted values #56

elslabbert opened this issue Jul 28, 2020 · 4 comments

Comments

@elslabbert
Copy link

Dear Hmsc team,

The Hmsc model I have run as a test round looks as follows:
'mod_input = Hmsc(Y = Y_past, XData = XData_p, XFormula = XFormula, Tr = past_traits, phyloTree = past_tree_only, YScale = TRUE, studyDesign = studyDesign_p, ranLevels = list("Site"=rL1,"Plot_ID"=rL2,"Subplot_ID"=rL3))
mod = sampleMcmc(mod_input, thin = thin, samples = samples, transient = transient,
nChains = nChains, verbose = verbose)'

In following up on the model to check the model fit I want to use the function 'computePredictedValues(mod)' but get the following error:

Error in PiNew[, r] <- sapply(dfPiNew[, r], function(s) which(rowNames == :
incorrect number of subscripts on matrix

As my model is running without an issue I suspect the issue lies elsewhere... I tried looking up sections of the this error in the function, but could not find is there explicitly to understand how to address the issue. Any ideas as to how to address this error?

Looking forward to your inputs

@ovaskain
Copy link
Collaborator

ovaskain commented Jul 29, 2020 via email

@jarioksa
Copy link
Collaborator

Same error message was reported in issue #47: see if it offers any useful information.

@elslabbert
Copy link
Author

Hi Osto, Hi Jarioksa,
Thanks for your respective responses. I have spent the last days going over all my data and fixing some inconsistencies.
I also worked though the issue #47, this was helpful in getting the random levels correct, but did not solve the error previously reported.

'Error in PiNew[, r] <- sapply(dfPiNew[, r], function(s) which(rowNames == :
incorrect number of subscripts on matrix'

Furthermore, I now have my Phylogeny not being included in the model anymore, although it was previously not an issues. The set-up for this section has not changed. So its odd that there is not a mismatch: 'Setting updater$Gamma2=FALSE due to specified phylogeny matrix'.

@elslabbert
Copy link
Author

Closing comment to this issue with input from package collaborators:
The issue here was linked indeed to the random levels. It, however, had to be solved by correcting both the levels of the random factors as specified in issue #47, as well as the structure of the studyDesgin to specify factor levels:

studyDesign = data.frame(Site = as.factor(S$Site), Plot_ID = as.factor(S$Plot_ID), Subplot_ID = as.factor(S$Subplot_ID))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants