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 with model-averaged hurdle models fitted through pscl #442
Comments
The problem seems to be that the formula gets distorted and its class is
In addition, we have
which is of class
where it appears that it's confused thinking that
At this time, I don't really see a way to anticipate or work around this. It seems like a glitch in |
Thank you for the detailed response! I'll get in touch with the developper of MuMIn, let's see. |
The problem was so obvious I couldn't see it. We have two models here, one for the counts and one for the zeros. So we have to have a way of specifying which. So I devised a
Having And the same for
Interesting discrepancy with the zero part. One is more or less 1 minus the other. I need to investigate that. We can also specify |
Please note in all of this, we do not have available any of the options for Another approach would be to create a fake
With this we have available all the options for regular hurdle models:
It seems to me that this is more fruitful and hardly more tedious. The estimates are slightly off from what I showed in the previous answer because they are averaged after re-gridding. We can get identical results if we insist on averaging on the link scale then summarizing with
|
Thank you very much Russell! Looking forward to these new functionalities in the next release! |
I think this is resolved, so am closing |
Describe the bug
emmeans won't work with model-averaged hurdle models, fitted through
pscl::hurdle()
. The error isError in update.default(object$formula, . ~ . + 1): need an object with call component
Expected behavior
I would expect to get the estimated marginal means.
emmeans()
will not complain with used on a hurdle model fitted throughglmmTMB
, alhtough the probabilities are not in the 0-1 interval (see reproducible example below).Additional context
Model-averaging was done with
MuMIn::model.avg()
. I get error messages if I don't specifyfit = TRUE
insideMuMIn::model.avg()
, or useemmeans()
without an explicitdata
argument, which is already anticipated by the emmeans documentation. In my research, I would store models in alist
, and uselapply()
to calculate model averaging and emmeans. However, since the error could be reproduced with model outside a list, I've opted to keep it simple, and provide a reproducible example without storing models in lists.Note that while glmmTMB can fit hurdle models, pscl is substantially faster. (besides, glmmTMB binomial component calculates the probability of observing a zero, which I don't find very inutitive).
Thanks in advance!
To reproduce
Created on 2023-09-14 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: