## apply to normal data
data(biom)
## produce first stage ANOVA fit
anMod <- lm(resp~factor(dose)-1, data=biom)
drFit <- coef(anMod)
vCov <- vcov(anMod)
dose <- sort(unique(biom$dose))
## now fit an emax model to these estimates
models <- list(emax = 0.2, linear = NULL)
gtst <- gMCPtest(dose, drFit, vCov, models = models, critV=TRUE)
print(gtst)
## apply to binary migraine data
data(migraine)
PFrate <- migraine$painfree/migraine$ntrt
doseVec <- migraine$dose
doseVecFac <- as.factor(migraine$dose)
## fit logistic regression with dose as factor
logfit <- glm(PFrate~doseVecFac-1, family = binomial, weights = migraine$ntrt)
drEst <- coef(logfit)
vCov <- vcov(logfit)
models <- list(linear = NULL, emax = 20)
gtest2 <- gMCPtest(doseVec, drEst, vCov, models = models)
gtest2
## use user specified contrast matrix
data(biom)
## calculate a contrast matrix
mu1 <- c(1, 2, 2, 2, 2)
mu2 <- c(1, 1, 2, 2, 2)
mu3 <- c(1, 1, 1, 2, 2)
mMat <- cbind(mu1, mu2, mu3)
dimnames(mMat)[[1]] <- sort(unique(biom$dose))
contMat <- planMM(muMat = mMat, doses = doses, n = 20, cV = FALSE)$contMat
## fit first stage model
anMod <- lm(resp~factor(dose)-1, data=biom)
drFit <- coef(anMod)
vCov <- vcov(anMod)
## perform MCP analysis
gMCPtest(drEst = drFit, vCov = vCov, contMat = contMat)
Run the code above in your browser using DataLab