[R-sig-ME] nlme package nonlinear mixed model error when fitting only fixed effects
Brenda Chang
ybc2 at cornell.edu
Mon Jun 24 19:42:18 CEST 2013
Dear all,
I am getting the error "Error in eval(expr, envir, enclos) : object 'a' not
found" when I want to model fixed effects in the *nlme package*:
library(nlme)
metdata <- read.csv("metdataf.csv", header=TRUE)
Model <- function(times=times, a=a, b=b, g=g) {
a + b*exp(-g*times)
}
ModelG <- deriv(
body(Model)[[2]],
namevec = c("a", "b", "g"),
function.arg=Model
)
fit.fixednlme <- nlme(conc~ModelG(times=times, a=a, b=b, g=g),
fixed=times~1,
data=metdata,
start=c(a=0,b=1,g=0))
I created a custom function of the form alpha+beta*exp(-gamma*time) that I
want nlme to use. I also tried the code below in the* lme4 package* but it
gave me a different error "Error: object of type 'symbol' is not subsettable
"
fit.fixedlme4 <- nlmer(conc ~ ModelG(times, a, b, g), data=metdata,
start=c(a=0,
b=1,g=0), verbose=TRUE)
Thank you so much in advance,
Best,
Brenda
More information about the R-sig-mixed-models
mailing list