[R] Basic NLME syntax

nrm2010 nrm2010 at zoho.com
Thu Feb 24 02:44:59 CET 2011


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 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?

Thank you in advance.

Toby Gass

tobygass at cnr dot colostate dot edu



More information about the R-help mailing list