Closed m-clark closed 2 years ago
Just to confirm: broom.mixed:::tidy.glmmTMB
also errors, presumably for the same reasons.
I've fixed several cases, though not where confint
itself fails. See https://github.com/glmmTMB/glmmTMB/issues/571
Update: there are still models where a basic confint()
will fail with TMB's current version, but in general extract_vc
should not, providing warnings about what's happened and still returning a viable data frame (and so summarize_model
should likewise not have issue). See the PR noted above.
This issue will be kept open until the dev version of glmmTMB that has supposedly fixed the issue (see PR here), is available on CRAN.
The main issue is that parm and component args cannot both be passed to confint without failure even now 2+ years later. extract_vc
won't fail as noted, so I'm closing this.
library(glmmTMB)
#> Warning in checkMatrixPackageVersion(): Package version inconsistency detected.
#> TMB was built with Matrix version 1.4.1
#> Current Matrix version is 1.5.1
#> Please re-install 'TMB' from source using install.packages('TMB', type = 'source') or ask CRAN for a binary version of 'TMB' matching CRAN's 'Matrix' package
m1 <- glmmTMB(
count ~ mined + (1 | site),
zi = ~ mined + (1 | site),
family = poisson,
data = Salamanders
)
confint(m1)
#> 2.5 % 97.5 % Estimate
#> cond.(Intercept) -0.1081713 0.5950014 0.2434151
#> cond.minedno 0.6123457 1.3704831 0.9914144
#> zi.(Intercept) 0.8401817 1.9936158 1.4168987
#> zi.minedno -2.7854483 -1.3253655 -2.0554069
#> cond.Std.Dev.(Intercept)|site 0.1278311 0.4076791 0.2282850
#> zi.Std.Dev.(Intercept)|site 0.3908530 1.0733644 0.6477095
confint(m1, parm = 'theta_')
#> 2.5 % 97.5 % Estimate
#> cond.Std.Dev.(Intercept)|site 0.1278311 0.4076791 0.2282850
#> zi.Std.Dev.(Intercept)|site 0.3908530 1.0733644 0.6477095
confint(m1, component = 'zi')
#> 2.5 % 97.5 % Estimate
#> zi.(Intercept) 0.8401817 1.993616 1.4168987
#> zi.minedno -2.7854483 -1.325366 -2.0554069
#> zi.Std.Dev.(Intercept)|site 0.3908530 1.073364 0.6477095
confint(m1, parm = 'theta_', component = 'zi') # should return last line of original but fails
#> Error in ci[parm, , drop = FALSE]: subscript out of bounds
Created on 2022-09-25 with reprex v2.0.2
This appears to be a result of the 1.0 release, but there are problems with residual variance, the component names are not included in some tmb models, continued issues with ar etc. models, and so forth.
Main thing for now is to get ci with extract_vc (and thus summarize_models) for standard glmm models. To do this, one needs to overcome the inconsistent
confint
returned result among other things.