[R] Error in nonlinear mixed-effects model

Revilla,AJ (pgt) A.J.Revilla at lse.ac.uk
Tue Apr 26 17:39:04 CEST 2005


Dear all,

I am trying to fit a mixed-effects non linear regression, but I have some trouble with it. My data are a balanced panel of 904 subjects with 8 observations (at regular periods) per subject.
The functional form of my model is Y=Aexp(-BX1)X2 +e. I want to allow parameters A and B to vary among subjects and also include an autocorrelation term. I have already fitted a standard nonlinear regression to the data, but I keep having problems with NLME.

I have defined my data as a groupedData object, and when I try to fit the model I get this error message:

dat<-groupedData(V~VAC|ID,data=dat)
attach(dat)
mod<-nlme(V~A*exp(B*YEAR)*VAC, fixed=A+B~1, random=A+B~1, correlation=corCAR1(), start=c(A=1.2,B=0.2))
Error in getGroups.data.frame(dataMix, eval(parse(text = paste("~1", deparse(groups[[2]]),  : 
        Invalid formula for groups

Do you have any clue of what’s happening? It’s the first time I fit a model like this in R, so the problem is probably pretty obvious, but I cannot see it.

Thank you very much,

Antonio




More information about the R-help mailing list