[R-sig-ME] Help with glmmADMB and ZIP mixed effects models

Ben Bolker bbolker at gmail.com
Sun May 21 02:12:34 CEST 2017



On 17-05-19 11:27 PM, Wang, Shirley wrote:
> Hello,
> 
> I'm hoping to run a zero-inflated mixed effects poisson regression model
> for count data. My dataset includes 111 subjects, randomized to 3 groups
> and each assessed 7 times (777 observations). Through searching online, it
> seems like the glmmADMB package is my best bet. From my understanding, NA
> missing values should be removed prior to analysis -- this leaves me with
> 264 observations. I tried running glmmadmb() with zero inflation, poisson,
> and mixed effects specified; however, I'm running into some errors. This is
> my dataset:
> 
>> str(x12)
> 'data.frame': 264 obs. of  12 variables:
>  $ Subject   : Factor w/ 111 levels "1","2","3","4",..: 1 1 1 1 2 2 2 3 4 4
> ...
>  $ Time      : int  1 5 6 7 1 5 7 1 1 6 ...
>  $ Group     : Factor w/ 3 levels "1","2","3": 1 1 1 1 1 1 1 1 1 1 ...
>  $ SRS       : int  56 55 56 55 50 46 42 49 47 42 ...
>  $ BDI       : int  40 23 41 35 44 14 11 22 16 9 ...
>  $ ERQ       : int  14 11 14 15 18 12 15 14 26 27 ...
>  $ Cut       : int  3 4 10 15 1 1 0 1 0 0 ...
>  $ NSSI      : int  8 14 32 58 2 2 8 2 0 1 ...
>  $ Ideation  : int  2 0 5 10 5 3 0 1 0 0 ...
>  $ Plan      : int  1 0 2 8 1 4 5 0 0 0 ...
>  $ Stop      : int  2 2 1 2 3 3 3 2 3 2 ...
>  $ Likelihood: int  4 4 4 4 3 4 4 4 3 3 ...
>  - attr(*, "na.action")=Class 'omit'  Named int [1:513] 2 3 4 9 10 11 13 16
> 17 18 ...
>   .. ..- attr(*, "names")= chr [1:513] "2" "3" "4" "9" ...
>>
> 

The error is somewhat interesting, if you can send your data I'd take a
look.  However, more generally troubleshooting glmmADMB problems is a
bit of a nuisance.  I would recommend trying the newer glmmTMB or brms
packages (both on CRAN; the latter is effectively a drop-in replacement
for glmmADMB, brms is a Bayesian MCMC engine built on the Stan engine).



> And here is my session info:
> 
>> sessionInfo()
> R version 3.3.3 (2017-03-06)
> Platform: x86_64-apple-darwin13.4.0 (64-bit)
> Running under: OS X Yosemite 10.10.5
> 
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
> 
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
> 
> other attached packages:
> [1] lme4_1.1-13      Matrix_1.2-8     pscl_1.4.9       lattice_0.20-34
> [5] glmmADMB_0.8.3.3 MASS_7.3-45
> 
> loaded via a namespace (and not attached):
>  [1] Rcpp_0.12.10     magrittr_1.5     splines_3.3.3    devtools_1.12.0
>  [5] munsell_0.4.3    colorspace_1.3-2 minqa_1.2.4      stringr_1.2.0
>  [9] plyr_1.8.4       tools_3.3.3      grid_3.3.3       nlme_3.1-131
> [13] gtable_0.2.0     coda_0.19-1      withr_1.0.2      digest_0.6.12
> [17] lazyeval_0.2.0   tibble_1.3.0     R2admb_0.7.15    nloptr_1.0.4
> [21] ggplot2_2.2.1    memoise_1.0.0    stringi_1.1.5    scales_0.4.1
>>
> 
> I tried to use the following formula, with "Cut" as my outcome, and got
> this lengthy error message:
> 
>> results <- glmmadmb(Cut ~ Time + Group + (1|Subject), data = x12,
> zeroInflation = TRUE, family = "poisson")
> matrix not pos definite in sparse choleski
> Parameters were estimated, but standard errors were not: the most likely
> problem is that the curvature at MLE was zero or negative
> Error in glmmadmb(Cut ~ Time + Group + (1 | Subject), data = x12,
> zeroInflation = TRUE,  :
>   The function maximizer failed (couldn't find parameter file)
> Troubleshooting steps include (1) run with 'save.dir' set and inspect
> output files; (2) change run parameters: see '?admbControl';(3) re-run with
> debug=TRUE for more information on failure mode
> In addition: Warning message:
> running command './glmmadmb -maxfn 500 -maxph 5 -noinit -shess' had status
> 42
> matrix not pos definite in sparse choleski
> matrix not pos definite in sparse choleski
> matrix not pos definite in sparse choleski
> matrix not pos definite in sparse choleski
> matrix not pos definite in sparse choleski
> matrix not pos definite in sparse choleski
> matrix not pos definite in sparse choleski
> matrix not pos definite in sparse choleski
> matrix not pos definite in sparse choleski
> matrix not pos definite in sparse choleski
> matrix not pos definite in sparse choleski
> matrix not pos definite in sparse choleski
> matrix not pos definite in sparse choleski
> matrix not pos definite in sparse choleski
> matrix not pos definite in sparse choleski
> matrix not pos definite in sparse choleski
> matrix not pos definite in sparse choleski
> matrix not pos definite in sparse choleski
> matrix not pos definite in sparse choleski
> matrix not pos definite in sparse choleski
> Error: Invalid index 111 used for array range [0, 110] in "double&
> dvector::operator[] (int i)".
> invalid index for array
> 
>>
> 
> How can I go about fixing this error? Alternatively, is there another way
> to run ZIP mixed models for count data? I had been successfully using the
> lme4 package w/ lmer function to run linear mixed models for continuous
> data, but I'm not sure whether this package can also handle zero-inflated
> count data.
> 
> Thank you so much in advance for any help or advice you might be able to
> provide!
> 
> Best,
> Shirley
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>



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