[R-sig-ME] Convergence check in lmer()
Antoine Tremblay
trea26 at gmail.com
Fri Feb 5 15:53:52 CET 2010
Dear David,
You could do something like create a log file where you would redirect
the warnings and error messages and then check the logs to see if a
particular model converged or not. For instance:
options(warn=1)
wngs=file("temp.txt",open="w+",blocking=TRUE)
sink(wngs,type="message")
Then to link up a specific model to the warning message (to know which
model did not converge) you could insert the following line before
running each model:
message("M1")
where "M1" is the name of the model object.
Then run your model
M1 <- lmer( y ~ avgprcp + avgtemp + (1 + mp + dv |acct), data = dat,
verbose=TRUE)
# you can see the message that it did not reach convergence after the iterations
save(M1, file="M1.rda")
rm(list=ls())
load("M1.rda")
summary(M1)
and repeat the same thing for your other models.
This would create a file named temp.txt that would contain first the
name of the model object then any warnings (if there were any) and
then the name of the next model object, and so forth.
--
Antoine Tremblay
Department of Neuroscience
Georgetown University
Washington DC
> Message: 7
> Date: Thu, 4 Feb 2010 13:01:01 -0800
> From: David Hsu <dhsu2 at uw.edu>
> To: r-sig-mixed-models at r-project.org
> Subject: [R-sig-ME] Convergence check in lmer()
> Message-ID:
> <8e8b187b1002041301r180cfcf3n11b81e6a81e27d73 at mail.gmail.com>
> Content-Type: text/plain
>
> Dear all,
>
> I've been running a series of large models on a remote computer, and store
> the model results as .rda files after every run to free up memory. However,
> I'm worried that some of the models did not in fact reach convergence. How
> can I check whether the models reached convergence from the resulting model
> objects?
>
> My example code, where M1 is the model object that I am storing:
>
> M1 <- lmer( y ~ avgprcp + avgtemp + (1 + mp + dv |acct), data = dat,
> verbose=TRUE)
> # you can see the message that it did not reach convergence after the
> iterations
> save(M1, file="M1.rda")
> rm(list=ls())
> load("M1.rda")
> summary(M1)
>
> Sincerely,
>
> David Hsu
>
>
> --
> David Hsu
> PhD Candidate, Urban Planning
> University of Washington
> (e-mail) dhsu2 at uw.edu
>
> [[alternative HTML version deleted]]
>
>
>
> ------------------------------
>
> _______________________________________________
> R-sig-mixed-models mailing list
> R-sig-mixed-models at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
> End of R-sig-mixed-models Digest, Vol 38, Issue 6
> *************************************************
>
More information about the R-sig-mixed-models
mailing list