# Log-transform variable birthyear and center it to the median
x<-saemixData(name.data=cow.saemix,name.group="cow",name.predictors=c("time"),
name.response="weight",
name.covariates=c("birthyear","twin","birthrank"),
units=list(x="d",y="kg",covariates=c("yr","-","-")),verbose=FALSE)
x2<-transformContCov(x,birthyear,centering="median",transformation=log,verbose=FALSE,
newCovName = "logYear")
print(summary(x2@data$logYear))
# Should be the same as:
print(summary(x@data$birthyear-median(x@data$birthyear)))
Run the code above in your browser using DataLab