[R-sig-ME] lme4 and false convergence
Douglas Bates
bates at stat.wisc.edu
Fri Nov 28 19:47:04 CET 2008
On Thu, Nov 27, 2008 at 2:07 AM, Goedhart, Paul <paul.goedhart at wur.nl> wrote:
> I had a similar problem which disappeared after standardizing the
> predictor variables. Apparently there is some numerical instability
> within LME4.
I think a case could be made for the numerical instability being in
the model definition, not in lme4.
> Below you will find a simulated example for a loglinear
> model.
>
> Paul W. Goedhart
> Biometris, Wageningen UR, Postbus 100, 6700 AC Wageningen, The
> Netherlands
>
>> require(lme4)
> Loading required package: lme4
> Loading required package: Matrix
> Loading required package: lattice
>
> Attaching package: 'Matrix'
>
>
> The following object(s) are masked from package:stats :
>
> xtabs
>
> Warning messages:
> 1: package 'lme4' was built under R version 2.7.2
> 2: package 'Matrix' was built under R version 2.7.2
>> # Simulate counts for a block design with a random blockeffect
>> set.seed(93923142)
>> nblock <- 10
>> nplot <- 4
>> nunit <- nblock * nplot
>> block <- rep(1:nblock, each=nplot)
>> plot <- rep(1:nplot, nblock)
>> rmean <- 25000
>> beta <- 10/rmean
>> xx <- round(rnorm(nunit, mean=rmean, sd=1000))
>> rblock <- rep(rnorm(nblock, mean=0, sd=0.5), each=nplot)
>> lp <- -9 + beta * xx
>> mu <- exp(lp + rblock)
>> response <- mu
>> for (ii in 1:nunit)
> + {
> + response[ii] <- rpois(1, mu[ii])
> + }
>> # GLMM with UN-STANDARDISED explanatory
>> mean(xx)
> [1] 24897.15
>> glmer <- glmer(response ~ xx + (1 | block), family=poisson)
> Warning message:
> In mer_finalize(ans) : false convergence (8)
>> glmer
> Generalized linear mixed model fit by the Laplace approximation
> Formula: response ~ xx + (1 | block)
> AIC BIC logLik deviance
> 59.16 64.23 -26.58 53.16
> Random effects:
> Groups Name Variance Std.Dev.
> block (Intercept) 0.66667 0.8165
> Number of obs: 40, groups: block, 10
>
> Fixed effects:
> Estimate Std. Error z value Pr(>|z|)
> (Intercept) -1.025e+01 2.915e+00 -3.517 0.000437 ***
> xx 4.454e-04 1.151e-04 3.872 0.000108 ***
> ---
> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
> Correlation of Fixed Effects:
> (Intr)
> xx -0.995
>> # GLMM with STANDARDISED explanatory
>> xxstan <- (xx-mean(xx))/sd(xx)
>> glmer <- glmer(response ~ xxstan + (1 | block), family=poisson)
>> glmer
> Generalized linear mixed model fit by the Laplace approximation
> Formula: response ~ xxstan + (1 | block)
> AIC BIC logLik deviance
> 57.12 62.18 -25.56 51.12
> Random effects:
> Groups Name Variance Std.Dev.
> block (Intercept) 0.28949 0.53804
> Number of obs: 40, groups: block, 10
>
> Fixed effects:
> Estimate Std. Error z value Pr(>|z|)
> (Intercept) 0.9260 0.1995 4.640 3.48e-06 ***
> xxstan 0.3597 0.1042 3.451 0.00056 ***
> ---
> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
> Correlation of Fixed Effects:
> (Intr)
> xxstan -0.166
>> q()
>
> -----Original Message-----
> From: r-sig-mixed-models-bounces at r-project.org
> [mailto:r-sig-mixed-models-bounces at r-project.org] On Behalf Of Ben
> Zuckerberg
> Sent: dinsdag 25 november 2008 14:46
> To: r-sig-mixed-models at r-project.org
> Subject: [R-sig-ME] lme4 and false convergence
>
> Dear R-users,
>
> I am using the most updated package of lme4 (lme4_0.999375-2). I have a
> data set consisting of ~900 observations at ~440 independent survey
> sites. There are an unbalanced number of surveys at each site. I am
> attempting to develop several models evaluating the presence/absence of
> a species (PRES) at these random sites (SITE) using a number of
> predictor variables. The response variable (PRES) is binomial and the
> included predictor variables are either proportions (e.g., AG, FOR,
> OPEN, LDEV,or DEV) or numerical (COUNT[min. 1 to max. 37,mean = 10]).
> ---------------------------------------------------------------------
> PROBLEM 1:
>
> I have developed the following GLMM:
>
> mix.1<-glmer(PRES~AG+FOR+OPEN+LDEV+DEV+COUNT+(1|SITE),family=binomial,da
> ta=merge1)
>
>
> I receive the following error:
> Warning message:
> In mer_finalize(ans) : false convergence (8)
>
> There is model output, but I am worried it might be biased.
> I have tried:
> -Data transformation of the predictor variables (e.g., log(COUNT)),
> which does seem successful in some simpler models, but does not work
> consistently.
> -The most updated version of lme4
>
> ---------------------------------------------------------------------
> PROBLEM #2:
> In addition, I am interested in visualizing the predicted probabilities
> from this output using the fixed effect function, but receive the
> following message:
>
> fixef(mix.1)
> Error in UseMethod("fixef") : no applicable method for "fixef"
>
> Any suggestions would be greatly appreciated!
>
> --
> Benjamin Zuckerberg, Ph.D.
> Post-doctoral Associate
> Spatial Ecologist, Citizen Science
> Cornell Laboratory of Ornithology
> 159 Sapsucker Woods Road
> Ithaca, NY 14850
> Tele: 607-254-2174
> Fax: 607-254-2111
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
> _______________________________________________
> 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