Skip to content
Prev 2962 / 20628 Next

nlmer/nlme with custom selfStart

I am trying to fit a nonlinear mixed effects model with a my own
selfStart model. The selfStart model works fine with nls. I have tried
fitting the model in nlme and nlmer, but I have been unable to
understand the error message either produces. The following example
demonstrates my problem. Can anybody tell me what I am doing wrong? I
have had this problem on R 2.9.1, lme4 0.999375-31, and nlme 3.1-92 on
Windows and R 2.9.0, lme4 0.999375-28, and nlme 3.1-90 on Linux.
selfStart(~log(epsilon0)+(alpha0)*x-log(1+epsilon0/(alpha0)*9.6770731089
10072*(exp((alpha0)*x)-1)),
+ function(mCall, data, LHS)
+ {
+ xy <- sortedXyData(mCall[["x"]], LHS, data)
+ tmp <- coef(lm(y~x, data=xy))
+ value <- c(exp(tmp[1]), tmp[2])
+ names(value) <- mCall[c("epsilon0", "alpha0")]
+ value
+ }, c("epsilon0", "alpha0"))
12)+0.001)))[1,]+log(epsilon0)+(alpha0)*my.data$x-log(1+epsilon0/(alpha0
)*9.677073108910072*(exp((alpha0)*my.data$x)-1)))
Nonlinear regression model
  model:  log(y) ~ SSslgr(x, epsilon0, alpha0) 
   data:  my.data 
 epsilon0    alpha0 
0.0004001 0.0200358 
 residual sum-of-squares: 6.346

Number of iterations to convergence: 3 
Achieved convergence tolerance: 1.508e-07
random=alpha0~1|group, data=my.data)
Error in nlmeCall[[i]] <- NULL : subscript out of bounds
Warning message:
package 'lme4' was built under R version 2.9.2
start=list(fixef=c(epsilon0=0.0004, alpha0=0.02)))
Error: object 'y' not found
Error in model.frame(data = my.data, formula = log(y),
drop.unused.levels = TRUE) : 
  error in evaluating the argument 'formula' in selecting a method for
function 'model.frame'

Mark Lyman, Statistician
Engineering Systems & Integration, ATK
Message-ID: <A6BB278845329C41A08CB3C52A0E2C1001F00FBE@ut40se02.atk.com>
In-Reply-To: <mailman.7.1256119202.11965.r-sig-mixed-models@r-project.org>