if (FALSE) {
## reproduce analysis from Pinheiro et al. (2014)
data(neurodeg)
## first fit the linear mixed effect model
library(nlme)
fm <- lme(resp ~ as.factor(dose):time, neurodeg, ~time|id, method = "ML")
muH <- fixef(fm)[-1] # extract estimates
covH <- vcov(fm)[-1,-1]
## derive optimal contrasts for candidate shapes
doses <- c(0, 1, 3, 10, 30)
mod <- Mods(emax = 1.11, quadratic= -0.022, exponential = 8.867,
linear = NULL, doses = doses) #
contMat <- optContr(mod, S=covH) # calculate optimal contrasts
## multiple contrast test
MCTtest(doses, muH, S=covH, type = "general", critV = TRUE,
contMat=contMat)
## fit the emax model
fitMod(doses, muH, S=covH, model="emax", type = "general",
bnds=c(0.1, 10))
## alternatively one can also fit the model using nlme
nlme(resp ~ b0 + (e0 + eM * dose/(ed50 + dose))*time, neurodeg,
fixed = b0 + e0 + eM + ed50 ~ 1, random = b0 + e0 ~ 1 | id,
start = c(200, -4.6, 1.6, 3.2))
## both approaches lead to rather similar results
}
Run the code above in your browser using DataLab