Skip to content

nlme model not working but lme models are fine [SEC=UNCLASSIFIED]

2 messages · Gosse, Michelle, Douglas Bates

#
Hi all,

I've replied to my message so hopefully the archive will stay tracking this as a single question.

Having examined the log likelihood formulae I was given for the SAS code, read Chapter 7 of Pinheiro & Bates, and searching for help,  I have got as far as (note, I am not using a grouped data frame as I get an error in nlme.fomula message saying that the "starting values for the fixed component are the wrong length" when I do this):

male.lme3 <- lme(BoxCoxXY ~ ordered(AgeFactor) + IntakeDay,
	data=Male.Data,
	random= ~1|RespondentID)

and then I am trying to run the following, and yes I wish the covariates to be additive the model I am basing this on (from SAS) has additive covariates:
Male.nlme <- nlme(BoxCoxXY ~ A + B*factor(AgeFactor) + C*factor(IntakeDay),
	data=Male.Data,
	fixed= A + B + C ~ 1,
	random=A ~1,
	group=RespondentID,
	start=fixef(male.lme3)
	)

I get the error " Error in eval(expr, envir, enclos) : object 'A' not found"

I don't have a more complicated model as the REML is taking care of it. Using the Wafer example in Chapter 8 of Pinheiro & Bates, and also this thread:
https://stat.ethz.ch/pipermail/r-sig-mixed-models/2011q1/005473.html

I thought I just had to show how the coefficients relate to the covariates and intercept. Clearly I have made an error of judgement, and I'm still not sure where I have gone wrong with the model. The Wafer nlme model uses A, B, and C in its model statement and the linked thread uses b0,...,b5. 

Would someone mind pointing out where I have gone wrong this time?

cheers
Michelle

-----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 Gosse, Michelle
Sent: Wednesday, January 11, 2012 4:05 PM
To: 'Douglas Bates'
Cc: r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] nlme model not working but lme models are fine [SEC=UNCLASSIFIED]

Hi,

Thanks for the help.  I'm now trying to figure out (1) the function and (2) how to specify it in nlme. 

cheers
Michelle

-----Original Message-----
From: dmbates at gmail.com [mailto:dmbates at gmail.com] On Behalf Of Douglas Bates
Sent: Wednesday, January 11, 2012 8:56 AM
To: Gosse, Michelle
Cc: r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] nlme model not working but lme models are fine [SEC=UNCLASSIFIED]
On Tue, Jan 10, 2012 at 1:05 PM, Gosse, Michelle <Michelle.Gosse at foodstandards.gov.au> wrote:
So what is the nonlinear model?  You haven't specified it in your call to nlme.
Your formula is not an nlme specification.  The right hand side of the formula should be a function call using nonlinear model parameters and covariates.  You are using a linear model formula on the right hand side and this will not give the result you are expecting.
UNCLASSIFIED

**********************************************************************
This email and any files transmitted with it are confide...{{dropped:9}}

_______________________________________________
R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

UNCLASSIFIED

**********************************************************************
This email and any files transmitted with it are confide...{{dropped:9}}
#
On Wed, Jan 11, 2012 at 4:35 PM, Gosse, Michelle
<Michelle.Gosse at foodstandards.gov.au> wrote:
The names of your starting values must correspond to the names used in
the formula (A, B and C).  I don't think that formula is what you want
because ordered(AgeFactor) will be converted to integer values 1, 2,
..., # of levels of AgeFactor and the same with factor(IntakeDay).
It is highly unlikely that this model does what you expect it to do.

In the end you would just end up with an awkward nonlinear model
formula representing a linear model.

You said that you were asked to fit a nonlinear mixed-effects model.
I recommend that you go back to the person who suggested this and get
clarification on what model they intended.  Converting a linear
mixed-effects model to a nonlinear model formula, in which all the
parameters occur linearly, and fitting that is not a nonlinear
mixed-effects model.  It is the same linear mixed-effects model fit
inefficiently.