Reputation: 31
I am looking at the interaction of 2 fixed variables and 1 random variable. Year has 19 levels and is numeric, beach is a factor and has 4 levels, method is a factor and has 3 levels. I am confused on the error messages below. NS1 is my nest success and it is weighted by the total number of eggs.
fit10<-glmer(NS1~0+beach+method+(1|year)+(1+beach*method|year),data=new1,weights=egg_total,family=binomial())
Warning messages:
1: In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!
2: In commonArgs(par, fn, control, environment()) : maxfun < 10 * length(par)^2 is not recommended.
3: In optwrap(optimizer, devfun, start, rho$lower, control = control, : convergence code 1 from bobyqa: bobyqa -- maximum number of function evaluations exceeded
4: In (function (fn, par, lower = rep.int(-Inf, n), upper = rep.int(Inf, : failure to converge in 10000 evaluations
5: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : unable to evaluate scaled gradient
6: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model failed to converge: degenerate Hessian with 17 negative eigenvalues
EDIT: I have changed my code to:
fit10<-glmer(NS1~0+beach+method+(1|year)+(1|beach/year)+ (1+method|year),data=new1,weights=crawls,family=binomial(),control=glmerControl(optimizer = "Nelder_Mead",optCtrl=list(maxfun=100000)))
which only gave me this warning message:
Warning message:
In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!
A sample of my data looks like this:
year beach method FC.. NS NS1 egg_total crawls
1 1997 Hillsboro HTL only 7 12.500000 0.12500000 0 8
2 1997 Hillsboro HTL only 4 33.333333 0.33333333 99 6
3 1997 Hillsboro HTL only 3 57.142857 0.57142857 0 7
4 1997 Hillsboro HTL only 2 33.333333 0.33333333 0 3
5 1997 Hillsboro HTL only 0 100.000000 1.00000000 104 2
6 1997 Hillsboro HTL only 0 100.000000 1.00000000 0 2
7 1997 Hillsboro HTL only 0 100.000000 1.00000000 190 4
8 1997 Hillsboro HTL only 1 66.666667 0.66666667 0 3
9 1997 Hillsboro HTL only 0 100.000000 1.00000000 114 1
10 1997 P/FTL HTL only 0 100.000000 1.00000000 0 1
11 1997 P/FTL no clean 0 100.000000 1.00000000 140 1
12 1997 P/FTL no clean 3 40.000000 0.40000000 277 5
13 1997 P/FTL HTL and SB 0 100.000000 1.00000000 0 1
14 1997 JUL no clean 0 100.000000 1.00000000 153 2
15 1997 JUL no clean 0 100.000000 1.00000000 113 2
16 1997 JUL no clean 0 100.000000 1.00000000 0 1
NS1 is simple NS/100
This goes on for a total of 866 lines in excel
Upvotes: 0
Views: 8757
Reputation: 1
The level left out is your reference level. Each parameter for the shown levels in your model summary should be added/subtracted from your reference level(the one left out). The reference level is parameter is estimated in the intercept term.
Upvotes: 0
Reputation: 226027
Repeating the model here for reference.
fit10<- glmer(NS1~0+beach+method+(1|year)+
(1+beach*method|year),
data=new1,
weights=egg_total,family=binomial())
The (1+beach*method|year)
term seems optimistic; this is estimating the among-year variation in the interaction between beach
and method
, which represents a 12x12 variance-covariance matrix (=n*(n+1)/2 = 78 parameters). Unless you have at least 1000 observations, you probably shouldn't try this. Also, the (1|year)
(intercept variation) and (1+beach*method|year)
terms are redundant, because the latter estimates the among-year variation in intercept, beach effect, method effect, and their interaction ... It might be more realistic to try (1|beach/year) + (1+method|year)
which fits intercept variation among beaches, years, beach:year interactions, and variation in method effects among years - a total of 1+1+(3*4/2)=8 variance-covariance parameters, which might still be too much depending on your data.
1: In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!
To figure out what's going on here, as @aosmith comments above, y <- NS1*egg_total
must be close to an integer (see binomial()$initialize
for the test, which is (any(abs(y - round(y)) > 0.001))
. If NS1
is supposed to be a proportion of eggs surviving, then this should work unless you made some kind of typo/rounding error somewhere.
This is something you want to figure out in order to make sure that the model actually makes sense; it's also possible that lme4 will behave badly with non-integer response variables for a distribution that's supposed to be integral.
2: In commonArgs(par, fn, control, environment()) : maxfun < 10 * length(par)^2 is not recommended.
This happens when your model has lots of parameters. You can increase maxfun
by using control=glmerControl(optCtrl=list(maxfun=1e6))
, but the real
3: In optwrap(optimizer, devfun, start, rho$lower, control = control, : convergence code 1 from bobyqa: bobyqa -- maximum number of function evaluations exceeded
This means the function didn't finish optimizing (see previous comment)
4: In (function (fn, par, lower = rep.int(-Inf, n), upper = rep.int(Inf, : failure to converge in 10000 evaluations
Ditto.
5: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : unable to evaluate scaled gradient
6: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model failed to converge: degenerate Hessian with 17 negative eigenvalues
Not worth worrying about these too much before your model is minimally working.
Upvotes: 3