[R] lme, best model without convergence
Spencer Graves
spencer.graves at pdf.com
Sun May 28 21:47:04 CEST 2006
lmeControl package:nlme R Documentation
Control Values for lme Fit
Description:
The values supplied in the function call replace the defaults and
a list with all possible arguments is returned. The returned list
is used as the 'control' argument to the 'lme' function.
##################
Note the last sentence. Now consider the following example, combining
modifications of your example with the example from "?lme":
> lmeCtlList <-
+ lmeControl(maxIter=2,
+ msMaxIter=3, tolerance=1e-4, niter=4,
+ msTol=1e-5, nlmStepMax=5,
+ ,msVerbose=TRUE
+ ,returnObject=TRUE
+ )
>
> fm1. <- lme(distance ~ age, data = Orthodont,
+ control=lmeCtlList) # random is ~ age
0 318.310: -0.202572 0.0501133 2.17193
1 318.297: -0.202071 0.0662548 2.16740
2 318.286: -0.207284 0.0593805 2.15302
3 318.257: -0.215916 0.0783916 2.12677
3 318.257: -0.215916 0.0783916 2.12677
Error in lme.formula(distance ~ age, data = Orthodont, control =
lmeCtlList) :
iteration limit reached without convergence (9)
> fm1.
Linear mixed-effects model fit by REML
Data: Orthodont
Log-restricted-likelihood: -221.3183
Fixed: distance ~ age
(Intercept) age
16.7611111 0.6601852
Random effects:
Formula: ~age | Subject
Structure: General positive-definite
StdDev Corr
(Intercept) 2.3270360 (Intr)
age 0.2264279 -0.609
Residual 1.3100396
Number of Observations: 108
Number of Groups: 27
>
Hope this helps.
Spencer Graves
p.s. First thanks for this example. I didn't know until I read your
question that one could actually get lme to return something when it
didn't converge. Second, you might have gotten a quicker reply if you
had included a simple, self-contained example, as suggested in the
posting guide! "www.R-project.org/posting-guide.html". Instead, since I
didn't know the answer, I had to invent one. If your example had been
self contained, you might have gotten an earlier reply from someone who
didn't have the time or inclination to invent an example like I did but
who might have otherwise been able to solve the problem.
Thomas Wutzler wrote:
> Dear R-help list readers,
>
> I am fitting mixed models with the lme function of the nlme package.
> If I get convergence depends on how the method (ML/REM) and which (and
> how much) parameters will depend randomly on the cluster-variable.
>
> How get the bist fit without convergence?
>
>
>
>
> I set the parameters msVerbose and returnObject to TRUE:
>
> lmeControl(maxIter=50000, msMaxIter=200, tolerance=1e-4, niter=50,
> msTol=1e-5, nlmStepMax=500,
> ,msVerbose=TRUE
> ,returnObject=TRUE
> )
>
> However, the lme-functions does not produce verbose output, nor does it
> return the best fit if lme is not converging.
> It returns only an error:
> Error in lme.formula(y ~ lndbh + I(lndbh^2) + lnh + I(lnh^2), random =
> ~lndbh + :
> iteration limit reached without convergence (9)
>
>
>
> Best regards
> Thomas
>
> ______________________________________________
> R-help at 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
More information about the R-help
mailing list