Dear R-user, I am trying to use the R "lmer" function in lme4 package to fit a non linear mixed effects model. The model I wand to fit is at an individual level with 4 parameters. For all parameters both fixed and random effects have to be estimated, as well as their covariance matrix (see the formula bellow). y~x1+x1^2+x2+x2^2. I tried to fit the model with my data sets, but most of the time, R returns an error message. there are three main types of errors : - In mer_finalize(ans, verbose) : function evaluation limit reached without convergence (9) - there are false convergence (8) -there are singular convergence (7) Do you know how to resolve these problems. Is there a way to modify the parameters of the maximization algorithm to avoid these error messages? Thank you for your help and answers. Regards, Yufeng Zhang
lme4 : lmer : convergence problem and other errors
10 messages · Doran, Harold, yufeng at nsm.umass.edu, Gillian Raab +2 more
4 days later
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20080708/9e75e5da/attachment.pl>
There is no way to know what is going on given your description below. You say you're fitting a non-linear model, but your notation is of a linear model. I see you square a covariate, but this doesn't make it a non-linear model, it is still linear in the parameters. We don't know anything about your data, your lmer syntax, all of which would be useful in helping you out.
-----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 yufeng at nsm.umass.edu Sent: Thursday, July 03, 2008 9:30 AM To: R-SIG-Mixed-Models at r-project.org Subject: [R-sig-ME] [R] lme4 : lmer : convergence problem and other errors Dear R-user, I am trying to use the R "lmer" function in lme4 package to fit a non linear mixed effects model. The model I wand to fit is at an individual level with 4 parameters. For all parameters both fixed and random effects have to be estimated, as well as their covariance matrix (see the formula bellow). y~x1+x1^2+x2+x2^2. I tried to fit the model with my data sets, but most of the time, R returns an error message. there are three main types of errors : - In mer_finalize(ans, verbose) : function evaluation limit reached without convergence (9) - there are false convergence (8) -there are singular convergence (7) Do you know how to resolve these problems. Is there a way to modify the parameters of the maximization algorithm to avoid these error messages? Thank you for your help and answers. Regards, Yufeng Zhang
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
Please see below:
1) What version of lmer are you running? The new version post 23/6/08 copes with difficult likelihoods better.
I used the most up-to-date version.
2) Have you changed anything in the elements of the control parameter. The pre 23/6 verion had several parameters and the later one fewer. In particular you can increase the iterations
How could I increase the iterations?
3) Have you centred your x variables so they have means around zero. If not you should always do this as it will make the fitting easier especially with quadratic terms. This ought to have been my first suggestion.
Do u mean the random effects of x's should be centered around 0? I didn't do that and I don't know how to do that in R? Could U tell me how? Thanks!
4) Having another look at your model you say it is non-linear, but it looks linear to me if you set the squared terms as covariates too.
You are right the model should be linear.
Good luck Gillian Raab Edinburgh On 03/07/2008, yufeng at nsm.umass.edu <yufeng at nsm.umass.edu> wrote:
Dear R-user, I am trying to use the R "lmer" function in lme4 package to fit a non linear mixed effects model. The model I wand to fit is at an individual level with 4 parameters. For all parameters both fixed and random effects have to be estimated, as well as their covariance matrix (see the formula bellow). y~x1+x1^2+x2+x2^2. I tried to fit the model with my data sets, but most of the time, R returns an error message. there are three main types of errors : - In mer_finalize(ans, verbose) : function evaluation limit reached without convergence (9) - there are false convergence (8) -there are singular convergence (7) Do you know how to resolve these problems. Is there a way to modify the parameters of the maximization algorithm to avoid these error messages? Thank you for your help and answers. Regards, Yufeng Zhang
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
-- Gillian M Raab 10 Ainslie Place EH3 6AS tel 0131 226 6234 mobile 07748 678 551
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20080708/fc5a9bde/attachment.pl>
Thank for your suggestions but why u want to center x variables around zero in that way? I just don't understand what is the advantage by doing that. Yufeng Quoting Gillian Raab <gillian.raab at googlemail.com>:
2008/7/8 <yufeng at nsm.umass.edu>:
Please see below:
1) What version of lmer are you running? The new version post 23/6/08
copes
with difficult likelihoods better.
I used the most up-to-date version.
2) Have you changed anything in the elements of the control parameter.
The
pre 23/6 verion had several parameters and the later one fewer. In particular you can increase the iterations
How could I increase the iterations?
READ THE HELP FILE UNDER LMER AND THE CONTROL PARAMETER
3) Have you centred your x variables so they have means around zero. If
not
you should always do this as it will make the fitting easier especially
with
quadratic terms. This ought to have been my first suggestion.
Do u mean the random effects of x's should be centered around 0? I didn't do that and I don't know how to do that in R? Could U tell me how? Thanks!
NOTHING FANCY JUST CALCULATE NEW X VARIABLES BY SUBTRACTING THE MEAN VALUES
4) Having another look at your model you say it is non-linear, but it
looks
linear to me if you set the squared terms as covariates too.
You are right the model should be linear.
Good luck Gillian Raab Edinburgh On 03/07/2008, yufeng at nsm.umass.edu <yufeng at nsm.umass.edu> wrote:
Dear R-user, I am trying to use the R "lmer" function in lme4 package to fit a non linear mixed effects model. The model I wand to fit is at an individual level
with
4 parameters. For all parameters both fixed and random effects have to be estimated, as well as their covariance matrix (see the formula bellow). y~x1+x1^2+x2+x2^2. I tried to fit the model with my data sets, but most of the time, R
returns
an error message. there are three main types of errors : - In mer_finalize(ans, verbose) : function evaluation limit reached without convergence (9) - there are false convergence (8) -there are singular convergence (7) Do you know how to resolve these problems. Is there a way to modify the parameters of the maximization algorithm to avoid these error messages? Thank you for your help and answers. Regards, Yufeng Zhang
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
-- Gillian M Raab 10 Ainslie Place EH3 6AS tel 0131 226 6234 mobile 07748 678 551
-- Gillian M Raab 10 Ainslie Place EH3 6AS tel 0131 226 6234 mobile 07748 678 551
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20080708/6a8b97b9/attachment.pl>
I'll add 2 cents worth here: I have long advocated subtracting off a nice round number near the middle of the range of x values, rather than using the mean of the x values in the current data set. This has a number of advantages, including ease of interpretation and the ability of others to easily reproduce the results and/or generate predicted values from the fitted model. The same argument applies to rescaling data by e.g. shifting the decimal point rather than "standardizing" x. Regards, Rob Kushler
Gillian Raab wrote:
Very basic statistical principal. It reduces the correlation between the x variables especially when you have quadratic terms. Models with correlated covariates are ill conditioned and fit badly and are subject to rounding errors. Those of us old enough to have to have done regressions with calculators know this very well but you young folk don't seem to know about it. Give it a try and see if it helps. Gillian 2008/7/8 <yufeng at nsm.umass.edu>:
Thank for your suggestions but why u want to center x variables around zero in that way? I just don't understand what is the advantage by doing that. Yufeng Quoting Gillian Raab <gillian.raab at googlemail.com>:
2008/7/8 <yufeng at nsm.umass.edu>:
Please see below:
1) What version of lmer are you running? The new version post 23/6/08
copes
with difficult likelihoods better.
I used the most up-to-date version.
2) Have you changed anything in the elements of the control
parameter.
The
pre 23/6 verion had several parameters and the later one fewer. In particular you can increase the iterations
How could I increase the iterations?
READ THE HELP FILE UNDER LMER AND THE CONTROL PARAMETER
3) Have you centred your x variables so they have means around zero.
If
not
you should always do this as it will make the fitting easier
especially
with
quadratic terms. This ought to have been my first suggestion.
Do u mean the random effects of x's should be centered around 0? I
didn't
do that and I don't know how to do that in R? Could U tell me how? Thanks!
NOTHING FANCY JUST CALCULATE NEW X VARIABLES BY SUBTRACTING THE MEAN
VALUES
4) Having another look at your model you say it is non-linear, but it
looks
linear to me if you set the squared terms as covariates too.
You are right the model should be linear.
Good luck Gillian Raab Edinburgh On 03/07/2008, yufeng at nsm.umass.edu <yufeng at nsm.umass.edu> wrote:
Dear R-user, I am trying to use the R "lmer" function in lme4 package to fit a
non
linear mixed effects model. The model I wand to fit is at an individual
level
with
4 parameters. For all parameters both fixed and random effects have
to be
estimated, as well as their covariance matrix (see the formula
bellow).
y~x1+x1^2+x2+x2^2. I tried to fit the model with my data sets, but most of the time, R
returns
an error message. there are three main types of errors : - In mer_finalize(ans, verbose) : function evaluation limit reached without convergence (9) - there are false convergence (8) -there are singular convergence (7) Do you know how to resolve these problems. Is there a way to modify
the
parameters of the maximization algorithm to avoid these error
messages?
Thank you for your help and answers. Regards, Yufeng Zhang
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
-- Gillian M Raab 10 Ainslie Place EH3 6AS tel 0131 226 6234 mobile 07748 678 551
-- Gillian M Raab 10 Ainslie Place EH3 6AS tel 0131 226 6234 mobile 07748 678 551
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20080708/1ad5ff86/attachment.pl>
1 day later
On Tue, Jul 8, 2008 at 8:53 AM, Gillian Raab
<gillian.raab at googlemail.com> wrote:
2008/7/8 <yufeng at nsm.umass.edu>:
Please see below:
1) What version of lmer are you running? The new version post 23/6/08
copes
with difficult likelihoods better.
I used the most up-to-date version.
The description "most up-to-date" can become wrong very quickly. It is better to quote a version number. Use sessionInfo() to get the version number.
2) Have you changed anything in the elements of the control parameter.
The
pre 23/6 verion had several parameters and the later one fewer. In particular you can increase the iterations
How could I increase the iterations?
READ THE HELP FILE UNDER LMER AND THE CONTROL PARAMETER
Well, actually, current versions of the help file should say that the
only control parameter recognized is msVerbose, which is the old way
of setting the "verbose" argument. Martin Maechler has pointed out on
several occasions that I should allow the maximum number of iterations
to be reset (also, the maximum number of function evaluations) but I
haven't done that yet.
There is a horrible hack that can be used to provide a greater number
of iterations. The arguments to the C function "mer_optimize" are an
mer object and a verbose flag. If the model fit fails because the
optimizer has exceeded the number of iterations you can take the
returned object and feed it directly back into
.Call("mer_optimize", <failed_lmer_fit>, FALSE, PACKAGE = "lme4")
As I say, this is a horrible hack and I should make it possible to set
the maximum number of iterations in the call to lmer rather than doing
this. However, doing so would involve creating the appropriate
argument names and defaults and my experience is that if this is done
hastily I end up regretting the resulting awkwardness.
3) Have you centred your x variables so they have means around zero. If
not
you should always do this as it will make the fitting easier especially
with
quadratic terms. This ought to have been my first suggestion.
Do u mean the random effects of x's should be centered around 0? I didn't do that and I don't know how to do that in R? Could U tell me how? Thanks!
NOTHING FANCY JUST CALCULATE NEW X VARIABLES BY SUBTRACTING THE MEAN VALUES
4) Having another look at your model you say it is non-linear, but it
looks
linear to me if you set the squared terms as covariates too.
You are right the model should be linear.
Good luck Gillian Raab Edinburgh On 03/07/2008, yufeng at nsm.umass.edu <yufeng at nsm.umass.edu> wrote:
Dear R-user, I am trying to use the R "lmer" function in lme4 package to fit a non linear mixed effects model. The model I wand to fit is at an individual level
with
4 parameters. For all parameters both fixed and random effects have to be estimated, as well as their covariance matrix (see the formula bellow). y~x1+x1^2+x2+x2^2. I tried to fit the model with my data sets, but most of the time, R
returns
an error message. there are three main types of errors : - In mer_finalize(ans, verbose) : function evaluation limit reached without convergence (9) - there are false convergence (8) -there are singular convergence (7) Do you know how to resolve these problems. Is there a way to modify the parameters of the maximization algorithm to avoid these error messages? Thank you for your help and answers. Regards, Yufeng Zhang
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
-- Gillian M Raab 10 Ainslie Place EH3 6AS tel 0131 226 6234 mobile 07748 678 551
--
Gillian M Raab
10 Ainslie Place EH3 6AS
tel 0131 226 6234
mobile 07748 678 551
[[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models