[R] errors with lme4
Ben Bolker
bbolker at gmail.com
Thu Nov 24 15:14:30 CET 2011
Alessio Unisi <franceschi6 <at> unisi.it> writes:
>
> Dear R-users,
> i need help for this topic!
>
> I'm trying to determine if the reproductive success
> (0=fail, 1=success) of a species of bird
> is related to a list of covariates.
>
> These are the covariates:
> § elev: elevation of nest (meters)
> § seadist: distance from the sea (meters)
> § meanterranova: records of temperature
> § minpengS1: records of temperature
> § wchillpengS1: records of temperature
> § minpengS2: records of temperature
> § wchillpengS2: records of temperature
> § nnd: nearest neighbour distance
> § npd: nearest penguin distance
> § eggs: numbers of eggs
> § lay: laying date (julian calendar)
> § hatch: hatching date (julian calendar)
> I have some NAs in the data.
>
> I want to test the model with all the variable then i want to remove
> some, but the ideal model:
> GLM.1 <-lmer(fledgesucc ~ +lay +hatch +elev +seadist +nnd +npd
> +meanterranova +minpengS1 +minpengS2 +wchillpengS1 +wchillpengS2
> +(1|territory), family=binomial(logit), data=fledge)
>
> doesn't work because of these errors:
> 'Warning message: In mer_finalize(ans) : gr cannot be computed at
> initial par (65)'.
> "matrix is not symmetric [1,2]"
>
> If i delete one or more of the T records (i.e. minpengS2 +wchillpengS2)
> the model works...below and example:
>
> GLM.16 <-lmer(fledgesucc ~ lay +hatch +elev +seadist +nnd +npd
> +meanterranova +minpengS1 +(1|territory), family=binomial(logit),
> data=fledge)
>
> > summary(GLM.16)
> Generalized linear mixed model fit by the Laplace approximation
> Formula: fledgesucc ~ lay + hatch + elev + seadist + nnd + npd +
> meanterranova + minpengS1 + (1 | territory)
> Data: fledge
> AIC BIC logLik deviance
> 174 204.2 -77 154
> Random effects:
> Groups Name Variance Std.Dev.
> territory (Intercept) 0.54308 0.73694
> Number of obs: 152, groups: territory, 96
>
I can't prove it, but I strongly suspect that some of your
coefficients are perfectly multicollinear. Try running your
model as a regular GLM:
g1 <- glm(fledgesucc ~ +lay +hatch +elev +seadist +nnd +npd
+meanterranova +minpengS1 +minpengS2 +wchillpengS1 +wchillpengS2
and see if some of the coefficients are NA.
coef(g1)
lm() and glm() can handle this sort of "rank-deficient" or
multicollinear input, (g)lmer can't, as of now.
I suspect that you may be overfitting your model anyway:
you should aim for not more than 10 observations per parameter
(in your case, since all your predictors appear to be continuous,
How many observations are left after na.omit(fledge)?
What is the difference between your 'S1' and 'S2' temperature
records?
More information about the R-help
mailing list