data(oxboys.saemix)
saemix.data<-saemixData(name.data=oxboys.saemix,header=TRUE,
name.group=c("Subject"),name.predictors=c("age"),name.response=c("height"),
units=list(x="yr",y="cm"))
# plot the data
plot(saemix.data)
growth.linear<-function(psi,id,xidep) {
x<-xidep[,1]
base<-psi[id,1]
slope<-psi[id,2]
f<-base+slope*x
return(f)
}
saemix.model<-saemixModel(model=growth.linear,description="Linear model",
psi0=matrix(c(140,1),ncol=2,byrow=TRUE,dimnames=list(NULL,c("base","slope"))),
transform.par=c(1,0),covariance.model=matrix(c(1,1,1,1),ncol=2,byrow=TRUE),
error.model="constant")
saemix.options<-list(algorithms=c(1,1,1),nb.chains=1,seed=201004,
save=FALSE,save.graphs=FALSE,displayProgress=FALSE)
# \donttest{
saemix.fit<-saemix(saemix.model,saemix.data,saemix.options)
# }
Run the code above in your browser using DataLab