[R-sig-ME] NLME model syntax
ONKELINX, Thierry
Thierry.ONKELINX at inbo.be
Mon Feb 28 15:56:50 CET 2011
Dear Toby,
Now I see what the problem is. You need to specify which parameter will be used in the random effects. See also the example in ?nlme
Suppose that you only want b0 to vary per chamber
test <- nlme(flux ~ b0 * exp((b1*soiltemp) - (b2*soiltemp^2)) * vpd^b3 * mstsoil2^b4 * airtemp^b5, data = ac5, fixed = list(b0 + b1 + b2 + b3 + b4 + b5 ~ 1), random = b0 ~ 1|chamber, start = c(b0 = 570, b1 = 0.08, b2 = 0.002, b3 = -0.06, b4 = 3, b5 = 0.3), subset = airtemp > 0)
Best regards,
Thierry
----------------------------------------------------------------------------
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium
Research Institute for Nature and Forest
team Biometrics & Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be
www.inbo.be
To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data.
~ Roger Brinner
The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
> -----Oorspronkelijk bericht-----
> Van: nrm2010 [mailto:nrm2010 at zoho.com]
> Verzonden: vrijdag 25 februari 2011 18:52
> Aan: ONKELINX, Thierry
> CC: r-sig-mixed-models at r-project.org
> Onderwerp: RE: [R-sig-ME] NLME model syntax
>
>
> Yes, I did try that and I had the same problem.
> I also tried it without the "list", as in "fixed = list...",
> based on previous bug reports, and that doesn't run either.
> But if I linearize it and use lme instead of nlme, it runs perfectly.
>
> Also, since I failed to mention this in the original message,
> it's nlme v. 3.1-98, R v. 2.11.1 with TINN-R interface on Windows OS.
>
> Thank you.
>
> Toby
>
>
>
> ---- On Fri, 25 Feb 2011 02:29:37 -0700 Thierry ONKELINX wrote ----
>
> >Have you tried to use a regular data.frame instead of a
> groupedData object?
> >
> >Best regards,
> >
> >Thierry
> >
> >-------------------------------------------------------------
> ----------
> >-----
> >ir. Thierry Onkelinx
> >Instituut voor natuur- en bosonderzoek team Biometrie &
> Kwaliteitszorg
> >Gaverstraat 4 9500 Geraardsbergen Belgium
> >
> >Research Institute for Nature and Forest team Biometrics & Quality
> >Assurance Gaverstraat 4 9500 Geraardsbergen Belgium
> >
> >tel. + 32 54/436 185
> >Thierry.Onkelinx at inbo.be
> >www.inbo.be
> >
> >To call in the statistician after the experiment is done may
> be no more than asking him to perform a post-mortem
> examination: he may be able to say what the experiment died of.
> >~ Sir Ronald Aylmer Fisher
> >
> >The plural of anecdote is not data.
> >~ Roger Brinner
> >
> >The combination of some data and an aching desire for an
> answer does not ensure that a reasonable answer can be
> extracted from a given body of data.
> >~ John Tukey
> >
> >
> >> -----Oorspronkelijk bericht-----
> >> Van: r-sig-mixed-models-bounces at r-project.org
> >> [mailto:r-sig-mixed-models-bounces at r-project.org] Namens nrm2010
> >> Verzonden: donderdag 24 februari 2011 23:16
> >> Aan: r-sig-mixed-models at r-project.org
> >> Onderwerp: [R-sig-ME] NLME model syntax
> >>
> >>
> >> Hello,
> >>
> >> I'm trying to use NLME for a non-linear model with one
> random effect
> >> that is the same as the one grouping level (chamber).
> >> Using the following
> >> statement:
> >>
> >> test <- nlme(flux ~ b0 * exp((b1*soiltemp) - (b2*soiltemp^2))
> >> * vpd^b3 * mstsoil2^b4 * airtemp^b5, data = ac5, fixed =
> list(b0 + b1
> >> + b2 + b3 + b4 + b5 ~ 1), random = chamber ~ 1, start =
> c(b0 = 570,
> >> b1 = 0.08, b2 = 0.002,
> >> b3 = -0.06, b4 = 3, b5 = 0.3), subset = airtemp > 0)
> >>
> >> I always get the error message
> >> "Error in eval(expr, envir, enclos) : object 'chamber' not found"
> >>
> >> Data "ac5" is a groupedData object with chamber as the grouping
> >> factor:
> >>
> >> > head(ac5)
> >> Grouped Data: flux ~ soiltemp + vpd + mstsoil2 + airtemp | chamber
> >>
> >> I've tried many variations such as
> >> random = list(chamber ~ 1) or random = ~1|chamber or adding the
> >> "groups" statement or trying to put chamber on the RHS of
> the model
> >> statement, after the fixed effects, but I always get the
> same error
> >> message.
> >>
> >> What is the correct way to formulate the call to nlme? Or
> is this not
> >> a syntax error?
> >>
> >> Thank you in advance.
> >>
> >> Toby Gass
> >>
> >> tobygass at cnr dot colostate dot edu
> >>
> >> _______________________________________________
> >> R-sig-mixed-models at r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> >>
>
>
>
>
More information about the R-sig-mixed-models
mailing list