[R-sig-ME] Help: Error message in nlme

Andrew Close andrew.close at newcastle.ac.uk
Tue Jan 29 14:31:36 CET 2013


Dear List,

I am trying to fit a non-linear mixed model using nlme library and to include a four-level factor as a covariate.

The model works perfectly well until I attempt to include the covariate- I then receive the following error message:


"Error in nlme.formula(model = cfu ~ SSasymp(Time, Asym, R0, lrc), data = PH64G, :  starting values for the fixed component are not the correct length"


This would suggest that I have included the correct number of starting parameters for the specified model, but I cannot see anything obviously wrong with the code that I am using.

I have attached the data set I am using and  the code below.

library(nlme)

PH64G<-read.csv("PH64G.csv",header=TRUE,row.names=1)
PH64G$Isolate<-factor(PH64G$Isolate)
PH64G$pH<-factor(PH64G$pH)

summary(PH64G)

PH64G<-groupedData(cfu ~ Time | Isolate/Replicate, inner = ~ pH,
labels = list(x="Time Heated (minutes)", y="Cell Counts Log10 CFU/ml"),
data = PH64G)

##############################
## Non-linear Least Squares Models ##
##############################
## Generic model using nls
mod1 <- nlsList(cfu ~ SSasymp(Time, Asym, R0, lrc) | Isolate/Replicate, PH64G)
mod1

########################
## Non-linear Mixed Model  ##
########################
mod2 <- nlme(mod1, random = pdDiag(Asym + R0 + lrc ~ 1), groups = ~ Isolate)

##

It is at the point of running model 3 to include the covariate that I receive the error message. From my understanding, I am attempting to estimate five random-effects parameters; Asym and R0 are allowed to vary according to pH (four-level factor) while lrc is estimated using only the intercept.

mod3 <- update(mod2, fixed = list(Asym ~ pH, R0 ~ pH, lrc ~ 1),
start=c(2.6442, 0, 7.9493, 0, -0.0985))
##

Any suggestions would be gratefully received.

With thanks

Andrew




More information about the R-sig-mixed-models mailing list