Re: [R] monte carlo simulations/lmer

From: Douglas Bates <dmbates_at_gmail.com>
Date: Tue 16 Aug 2005 - 04:16:33 EST

On 8/13/05, Eduardo Leoni <e.leoni@gmail.com> wrote:
> Hi - I am doing some monte carlo simulations comparing bayesian (using
> Plummer's jags) and maximum likelihood (using lmer from package lme4
> by Bates et al).
>
> I would like to know if there is a way I can flag nonconvergence and
> exceptions. Currently the simulations just stop and the output reads
> things like:
>
> Error in optim(.Call("lmer_coef", x, 2, PACKAGE = "Matrix"), fn, gr,
> method = "L-BFGS-B", :
> L-BFGS-B needs finite values of 'fn'
> In addition: Warning message:
> Leading minor of size 1 of downdated X'X is indefinite
>
> Error in .local(object, ...) : Leading 2 minor of Omega[[1]] not
> positive definite
> In addition: Warning messages:
> 1: optim or nlminb returned message ERROR: ABNORMAL_TERMINATION_IN_LNSRCH
> in: "LMEoptimize<-"(`*tmp*`, value = list(maxIter = 200, msMaxIter = 200,
> 2: optim or nlminb returned message ERROR: ABNORMAL_TERMINATION_IN_LNSRCH
> in: "LMEoptimize<-"(`*tmp*`, value = list(maxIter = 200, msMaxIter = 200,

As Rolf Turner indicated, you can wrap the call to lmer in try() to prevent breaking the loop on convergence failure. I'm not sure exactly what Bayesian analysis you are doing but you may want to look at the function mcmcsamp in versions 0.98-1and later of the Matrix package. It can take a fitted lmer object and create an MCMC sample from the posterior distribution of the parameters assuming a locally uniform prior on the fixed-effects parameters and the non-informative prior described by Box and Tiao for the variance-covariance matrices.



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Aug 16 04:21:28 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:21:19 EST