[R] nlme and start=list()
Douglas Bates
bates at stat.wisc.edu
Fri Nov 22 20:17:47 CET 2002
Andrew Beckerman <a.p.beckerman at stir.ac.uk> writes:
> Dear Listers -
>
> R1.61 on NT
>
> We are trying to fit a polynomial usning nlme so that in ax^2+bx+c, c
> is fixed and a and b are random.
>
>
> The data are
> Frames = speed of flight (20-50)
> Manlength = tail length (-20,0)
> ID = individual (14 of them)
>
> each individual has experienced each of 6 tail lengths in the range
> above and we are interested in the shape of the relationship between
> speed and manipulation.
>
>
> using the following approach based on the Venables and Ripley (3rd ed)
> examples with the Sitka data set
>
>
> nlme(Frames~a*Manlength^2+b*Manlength+c,
> + fixed=list(c~1),random=a+b~1|ID,
> + start=list(fixed=c(0.3,6,50)))
>
> Error in nlme.formula(Frames ~ a * Manlength^2 + b * Manlength + c,
> fixed = list(c ~ :
>
> starting values for the fixed component are not the correct length
>
> -realizing that something is wrong with how we have framed the start
> values... can anyone advise?
First the good news - you don't need to use nlme to fit a polynomial
model. A polynomial is linear in the coefficients so you can use lme,
which is much easier than nlme.
lme(Frames ~ Manlength + I(Manlength^2), random = Manlength)
The problem with your usage of nlme is that you gave 3 values for the
starting estimates of the fixed-effects parameters and there is only
one parameter for fixed-effects the way you wrote it. You should have
used "fixed=list(a+b+c ~ 1)" (or, equivalently, "fixed=a+b+c~1") but
you really don't want to use nlme for a linear model.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list