Hello,
I'm trying to fit a hurdle mixed effects model, looking at cod abundance
(cod0, cod1, and cod2). Because of the overdispersion and zero-inflation,
I'm trying to use a hurdle model with the first stage as a binomial GLMM
and the second stage a negative binomial GLMM. We have chosen site to be a
random effect. Here is a summary of the data I'm working with:
str(div.3a)
'data.frame': 325 obs. of 21 variables:
$ beach : Factor w/ 56 levels "1","2","3","4",..: 1 1 1 1 1 1 1
1 1 7 ...
$ shannons : num 1.017 1.014 1.302 0.853 1.325 ...
$ year : Factor w/ 12 levels "59","60","61",..: 3 5 4 7 11 6 9
10 8 7 ...
$ region : Factor w/ 6 levels "Bonavista Bay",..: 5 5 5 5 5 5 5 5
5 5 ...
$ species.rich : int 6 7 6 7 6 5 6 4 6 3 ...
$ year.range : Factor w/ 2 levels "1960-1964","1992-1996": 1 1 1 2 2
1 2 2 2 2 ...
$ sum.tfish : num 137 120 157 84 73 56 20 5 320 96 ...
$ evenness : num 0.568 0.521 0.726 0.439 0.74 ...
$ cod0 : int 24 43 0 0 0 3 0 0 0 9 ...
$ cod1 : int 47 10 48 0 0 8 0 0 1 0 ...
$ cod2 : int 0 0 5 0 0 0 0 0 0 0 ...
$ beach.name : Factor w/ 56 levels "Admirals Beach",..: 26 26 26 26
26 26 26 26 26 52 ...
$ site.no : Factor w/ 42 levels "1","2","5","6",..: 1 1 1 1 1 1 1
1 1 5 ...
$ depth : num 4 4 4 4 4 4 4 4 4 3 ...
$ vegetation : Factor w/ 2 levels "0","1": 2 2 2 2 2 2 2 2 2 2 ...
$ eelgrass : int 1 1 1 1 1 1 1 1 1 0 ...
$ kelp : int 0 0 0 0 0 0 0 0 0 1 ...
$ cod0nz : num 1 1 0 0 0 1 0 0 0 1 ...
$ cod1nz : num 1 1 1 0 0 1 0 0 1 0 ...
$ cod2nz : num 0 0 1 0 0 0 0 0 0 0 ...
(I'm using likelihood ratio tests using anova() by adding one term at a
time). First fitting the binomial glmmadmb:
cod1b.1 <- glmmadmb(data=div.3a, cod1nz ~ (1|site.no), family="binomial")
#works fine
cod1b.2 <- glmmadmb(data=div.3a, cod1nz ~ year.range + (1|site.no),
family="binomial")
## the above returns the following error message:
Parameters were estimated, but not standard errors were not: the most
likely problem is that the curvature at MLE was zero or negative
Error in glmmadmb(data = div.3a, cod1nz ~ year.range + (1 | site.no), :
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
"C:/Users/Scott/Documents/R/win-library/3.2/glmmADMB/bin/windows64/glmmadmb.exe"
-maxfn 500 -maxph 5' had status 1
################
So looking at this error message, I first attempted to inspect the output
files but was quickly lost. I then looked into admbControl() and tried the
following:
cod1b.2 <- glmmadmb(data=div.3a, cod1nz ~ year.range + (1|site.no),
family="binomial", admb.opts=admbControl(noinit=FALSE, shess=FALSE))
#This unfortunately returns the exact same error message.
What's quite strange is when I add in the next term I want to do null
hypothesis testing on ("region"), I don't get an error.
cod1b.3 <- glmmadmb(data=div.3a, cod1nz ~ year.range + region + (1|site.no),
family="binomial")
However when I add the next term, "vegetation", I get this error:
cod1b.4 <- glmmadmb(data=div.3a, cod1nz ~ year.range + region + vegetation
+ (1|site.no), family="binomial")
Warning message:
In glmmadmb(data = div.3a, cod1nz ~ year.range + region + vegetation + :
Convergence failed:log-likelihood of gradient= -0.0434684
If anybody has any insight about these error messages, please let me know!
Here is my sessionInfo():
R version 3.2.1 (2015-06-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_Canada.1252 LC_CTYPE=English_Canada.1252
LC_MONETARY=English_Canada.1252 LC_NUMERIC=C
[5] LC_TIME=English_Canada.1252
attached base packages:
[1] grid stats graphics grDevices utils datasets methods
base
other attached packages:
[1] glmmADMB_0.8.0 matrixStats_0.14.2 beepr_1.2 lmtest_0.9-34
zoo_1.7-12 gridExtra_2.0.0 pscl_1.4.9
[8] MASS_7.3-40 mgcv_1.8-7 nlme_3.1-120
statmod_1.4.21 tweedie_2.2.1 lme4_1.1-8 Matrix_1.2-1
[15] xtable_1.7-4 mvabund_3.10.4 ggplot2_1.0.1 stringr_1.0.0
vegan_2.3-0 lattice_0.20-31 permute_0.8-4
[22] reshape2_1.4.1 dplyr_0.4.2
loaded via a namespace (and not attached):
[1] Rcpp_0.12.0 R2admb_0.7.5.3 nloptr_1.0.4 plyr_1.8.3
tools_3.2.1 digest_0.6.8 gtable_0.1.2 DBI_0.3.1
[9] parallel_3.2.1 proto_0.3-10 cluster_2.0.1 R6_2.1.0
minqa_1.2.4 magrittr_1.5 scales_0.2.5 splines_3.2.1
[17] assertthat_0.1 colorspace_1.2-6 stringi_0.5-5 lazyeval_0.1.10
munsell_0.4.2 audio_0.1-5
Thanks!
Scott
Binomial glmmadmb error message
2 messages · Scott McCain, Paul Johnson
9 days later
Hi pj Paul Johnson http://pj.freefaculty.org
On Aug 2, 2015 2:25 PM, "Scott McCain" <jspmccain at gmail.com> wrote:
Hello, I'm trying to fit a hurdle mixed effects model, looking at cod abundance (cod0, cod1, and cod2). Because of the overdispersion and zero-inflation, I'm trying to use a hurdle model with the first stage as a binomial GLMM and the second stage a negative binomial GLMM. We have chosen site to be a random effect. Here is a summary of the data I'm working with: str(div.3a) 'data.frame': 325 obs. of 21 variables: $ beach : Factor w/ 56 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1 1 7 ... $ shannons : num 1.017 1.014 1.302 0.853 1.325 ... $ year : Factor w/ 12 levels "59","60","61",..: 3 5 4 7 11 6 9 10 8 7 ... $ region : Factor w/ 6 levels "Bonavista Bay",..: 5 5 5 5 5 5 5
5
5 5 ... $ species.rich : int 6 7 6 7 6 5 6 4 6 3 ... $ year.range : Factor w/ 2 levels "1960-1964","1992-1996": 1 1 1 2 2 1 2 2 2 2 ... $ sum.tfish : num 137 120 157 84 73 56 20 5 320 96 ... $ evenness : num 0.568 0.521 0.726 0.439 0.74 ... $ cod0 : int 24 43 0 0 0 3 0 0 0 9 ... $ cod1 : int 47 10 48 0 0 8 0 0 1 0 ... $ cod2 : int 0 0 5 0 0 0 0 0 0 0 ... $ beach.name : Factor w/ 56 levels "Admirals Beach",..: 26 26 26 26 26 26 26 26 26 52 ... $ site.no : Factor w/ 42 levels "1","2","5","6",..: 1 1 1 1 1 1 1 1 1 5 ... $ depth : num 4 4 4 4 4 4 4 4 4 3 ... $ vegetation : Factor w/ 2 levels "0","1": 2 2 2 2 2 2 2 2 2 2 ... $ eelgrass : int 1 1 1 1 1 1 1 1 1 0 ... $ kelp : int 0 0 0 0 0 0 0 0 0 1 ... $ cod0nz : num 1 1 0 0 0 1 0 0 0 1 ... $ cod1nz : num 1 1 1 0 0 1 0 0 1 0 ... $ cod2nz : num 0 0 1 0 0 0 0 0 0 0 ... (I'm using likelihood ratio tests using anova() by adding one term at a time). First fitting the binomial glmmadmb: cod1b.1 <- glmmadmb(data=div.3a, cod1nz ~ (1|site.no), family="binomial") #works fine cod1b.2 <- glmmadmb(data=div.3a, cod1nz ~ year.range + (1|site.no), family="binomial") ## the above returns the following error message: Parameters were estimated, but not standard errors were not: the most likely problem is that the curvature at MLE was zero or negative Error in glmmadmb(data = div.3a, cod1nz ~ year.range + (1 | site.no), : 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
"C:/Users/Scott/Documents/R/win-library/3.2/glmmADMB/bin/windows64/glmmadmb.exe"
-maxfn 500 -maxph 5' had status 1 ################ So looking at this error message, I first attempted to inspect the output files but was quickly lost. I then looked into admbControl() and tried the following:
I suspect quasi-complete separation here. For one year.range value, there is no diversity. That generally gives back this kind of error. If I were you, i'd get table(div.3a, year.range, site.no) to see.
cod1b.2 <- glmmadmb(data=div.3a, cod1nz ~ year.range + (1|site.no),
family="binomial", admb.opts=admbControl(noinit=FALSE, shess=FALSE))
#This unfortunately returns the exact same error message.
What's quite strange is when I add in the next term I want to do null
hypothesis testing on ("region"), I don't get an error.
cod1b.3 <- glmmadmb(data=div.3a, cod1nz ~ year.range + region + (1|site.no
),
family="binomial") However when I add the next term, "vegetation", I get this error: cod1b.4 <- glmmadmb(data=div.3a, cod1nz ~ year.range + region + vegetation + (1|site.no), family="binomial") Warning message: In glmmadmb(data = div.3a, cod1nz ~ year.range + region + vegetation + : Convergence failed:log-likelihood of gradient= -0.0434684 If anybody has any insight about these error messages, please let me know! Here is my sessionInfo(): R version 3.2.1 (2015-06-18) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 8 x64 (build 9200) locale: [1] LC_COLLATE=English_Canada.1252 LC_CTYPE=English_Canada.1252 LC_MONETARY=English_Canada.1252 LC_NUMERIC=C [5] LC_TIME=English_Canada.1252 attached base packages: [1] grid stats graphics grDevices utils datasets methods base other attached packages: [1] glmmADMB_0.8.0 matrixStats_0.14.2 beepr_1.2
lmtest_0.9-34
zoo_1.7-12 gridExtra_2.0.0 pscl_1.4.9 [8] MASS_7.3-40 mgcv_1.8-7 nlme_3.1-120 statmod_1.4.21 tweedie_2.2.1 lme4_1.1-8 Matrix_1.2-1 [15] xtable_1.7-4 mvabund_3.10.4 ggplot2_1.0.1
stringr_1.0.0
vegan_2.3-0 lattice_0.20-31 permute_0.8-4
[22] reshape2_1.4.1 dplyr_0.4.2
loaded via a namespace (and not attached):
[1] Rcpp_0.12.0 R2admb_0.7.5.3 nloptr_1.0.4 plyr_1.8.3
tools_3.2.1 digest_0.6.8 gtable_0.1.2 DBI_0.3.1
[9] parallel_3.2.1 proto_0.3-10 cluster_2.0.1 R6_2.1.0
minqa_1.2.4 magrittr_1.5 scales_0.2.5 splines_3.2.1
[17] assertthat_0.1 colorspace_1.2-6 stringi_0.5-5 lazyeval_0.1.10
munsell_0.4.2 audio_0.1-5
Thanks!
Scott
[[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models