Description Usage Format Details Source Examples
The oxboys.saemix
data frame has 234 rows and 4 columns.
1 |
This data frame contains the following columns:
an ordered factor giving a unique identifier for each boy in the experiment
a numeric vector giving the standardized age (dimensionless)
a numeric vector giving the height of the boy (cm)
an ordered factor - the result of converting 'age' from a continuous variable to a count so these slightly unbalanced data can be analyzed as balanced.
These data are described in Goldstein (1987) as data on the height of a selection of boys from Oxford, England versus a standardized age. The dataset can be found in the package nlme
.
We use an linear model for this data: y_ij = Base_i + slope_i x_ij +epsilon_ij
Pinheiro, J. C. and Bates, D. M. (2000), _Mixed-Effects Models in S and S-PLUS_, Springer, New York. (Appendix A.19)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
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) {
# input:
# psi : matrix of parameters (2 columns, base and slope)
# id : vector of indices
# xidep : dependent variables (same nb of rows as length of id)
# returns:
# a vector of predictions of length equal to length of id
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)
# Not run (strict time constraints for CRAN)
# saemix.fit<-saemix(saemix.model,saemix.data,saemix.options)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.