# [R-sig-ME] parametric bootstrap with glmmTBmodel with Tweedie dist

Pablo Inchausti p@blo@inch@u@ti@f @ending from gm@il@com
Wed Aug 29 15:34:53 CEST 2018

```Dear All,
After fitting two models with Tweedie distr with glmmtmb, I need to
compared them using parametric bootstrap because these models differ in
their random effects.
mod1=glmmTMB(actmono~Resin.P.s+Total.P.s+pH.KCl.s+C.s+(1|fieldnumber)+(1|spsab),data=DF,
family=tweedie(link="log"))   has  only random intercepts
mod2=glmmTMB(actmono~Resin.P.s+Total.P.s+pH.KCl.s+C.s+(1|fieldnumber)+(Resin.P.s|spsab),data=DF,
family=tweedie(link="log")) has both random intercepts AND slopes.
As far as I understand, parametric bootstrap is the only acceptable way t
compare these two models. (I need to use Tweedie because the response
variable has many (>30%) zeros and the remaining are positive, real values)

My attempts:
1) pbmodcomp from library pbkrtest does not accept models fitted with
glmmtmb.
2) I tried comparing the logLik ratios of the two models doing:
bmod1=bootMer(mod1, FUN = function(x) as.numeric(logLik(x)), nsim = 500,
type = "parametric", use.u=F)
bmono3=bootMer(mono3, FUN = function(x) as.numeric(logLik(x)), nsim = 500,
type = "parametric", use.u=F)
lrt=as.numeric(-2*(logLik(m3.2) -logLik(m3.1))) # observed LRT
lrt.b=-2*(bm3.2\$t-bm3.1\$t) # distribution of  simulated LRT
quantile(lrt.b, c(0.025,0.975))
summary(lrt.b)
(if I recall correctly, I had pillaged this idea from some web post by Ben
Bolker, and it had worked well with other GLMM fitted with lme4)

I obtained the following error message:
Error in match.arg(name) :
'arg' should be one of “X”, “Xzi”, “Z”, “Zzi”, “Xd”, “theta”

I looked into the help of bootMer and it only says that the first argument
should be a fitted merMod object (I believe that models fitted with glmmtmb
are of this type too).

Any help or suggestions would be appreciated.
Regards,
Pablo

[[alternative HTML version deleted]]

```