[R-sig-ME] glmmADMB package

Ben Bolker bbolker at gmail.com
Sun Jul 20 01:55:48 CEST 2014


Rajibul Mian <rajibulmian at ...> writes:

> 
> Dear All,
> 
> I have been facing problem running the following code by using
> ---glamADMB()--
> 
> glmmadmb(y_zibb~x+factor(z)+g, data= data_mis_model, family =
> "betabinomial", link = "logit", zeroInflation=T)
> 
> where "y_zibb" contains zero inflated Beta Binomial response ,
> "x" is a normal random variate
> "z" is a binomial random variate
> "g" is a exponential random variate
> 
> the error message----
> 
> Error in glmmadmb(y_zibb ~ x + factor(z) + g, data = data_mis, family =
> "betabinomial",  :
>   The function maximizer failed (couldn't find STD file) Troubleshooting
> steps include (1) run with 'save.dir' set and inspect output files; (2)
> change run parameters: see '?admbControl'
> In addition: Warning message:
> running command 'C:\Windows\system32\cmd.exe /c
> -maxfn 500 -maxph 5 -noinit -shess' had status 22
> 
> I have tried the  "change run parameters: see '?admbControl'" in different
> combinations but couldn't help.  I am giving part of the data with this
> mail.
> 

With the data you've given, it's hardly worth fitting the z component
(out of 100 values, only 4 are 1, the rest are zero -- very little
information here).

If you don't have any random effects, you don't really need
glmmADMB -- you can do the problem in pure R (although it might
be faster & more robust if you were able to get it working in
glmmADMB).

A little bit of exploration:

dd <- read.table("mian_mm.dat",header=TRUE)
library(ggplot2); theme_set(theme_bw())
ggplot(dd,aes(x,y_zibb))+geom_point(aes(colour=g),size=4, alpha=0.5)
ggplot(dd,aes(x,y_zibb))+geom_point(aes(colour=log10(g),shape=factor(z)),
                                    size=4, alpha=0.7)

The values of g are so restricted that I decided it might make
more sense to use log10(g) rather than g as a predictor variable
(unless you have some strong _a priori_ reason for using it on
the original scale).

with(dd,table(z))  ## only 4 '0' values
par(las=1,bty="l")
with(dd,hist(log10(g),col="gray"))


These fits both work OK:

library(emdbook)  ## for dbetabinom
library(bbmle)
## fit with NON-zero-inflated beta-binomial
(m1 <- mle2(y_zibb~dbetabinom(prob=plogis(eta),theta=exp(logtheta),
                       size=10),
     parameters=list(eta~log10(g)),
     start=list(eta=0,logtheta=0),
     data=dd))
## define zero-inflated version of dbetabinom
dzibb <- function(x,prob,size,theta,zprob,log=FALSE) {
    dd <- dbetabinom(x,prob=prob,size=size,theta=theta,log=FALSE)
    rr <- ifelse(x==0,zprob+(1-zprob)*dd,(1-zprob)*dd)
    if (log) log(rr) else rr
}
(m2 <- mle2(y_zibb~dzibb(prob=plogis(eta),
                         theta=exp(logtheta),
                         zprob=plogis(eta2),
                         size=10),
            parameters=list(eta~log10(g)),
            start=list(eta=0,logtheta=0,eta2=-3),
            data=dd))

> Any related suggestions would help. Thank you.
> 
> Best.
> Rajibul Mian
> Grad Student, Maths & STATS,
> UWindsor, Canada.
>



More information about the R-sig-mixed-models mailing list