[R] Question On NLME

From: Daniel H. li <lihe418_at_yahoo.com>
Date: Sun 22 May 2005 - 01:15:46 EST


Hello r-help,
I am doing a simulation study nonlinear mixed effects models by using nlme. Here is a simple example fm.log1<-function(n){
result1<-matrix(0,n,5)
for (j in 1:n){
x=rep(rnorm(8,10,5),6)

b1=20
b2=rep(rnorm(8,0,2),each=6)
b3=15
b4=4
e=rnorm(48,0,1)
y=(b1+b2)/(1+exp((b3-x)/b4))+e

z=rep(1:6,each=8)
o=data.frame(cbind(z,x,y))
oo=groupedData(y~x|z,data=o)
CO.func<-function(x,A,B,C) A/(1+(exp((B-x)/C))) fn.ML<-nlme(model=y~CO.func(x,A,B,C),data=oo, fixed=A+B+C~1,random=A~1,start = c(A=20.5,B=13,C=4.5)) result1[j,]<-matrix(c(fn.ML$coef$fixed,as.numeric(VarCorr(fn.ML)[,1])),5,1)} apply(result1,2,mean)}

It is a logistic model with one random effect. When I take a large simulation size n such as 100, the program can not run and error messages will appear. I believe it is the problem of simulation. Sometimes the simulated data may not be good to use nlme. How should I fix this problem to do the simulation study? Thanks  


        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sun May 22 01:20:21 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:59 EST