# NOT RUN {
##
data(Ohio)
##
XM <- cbind(Int=1, Ohio[,1:3])
fitM <- glm(cbind(Death, N-Death) ~ factor(Age) + Sex + Race, data=Ohio,
family=binomial)
betaNamesM <- c("Int", "Age1", "Age2", "Sex", "Race")
## Power for the TPS design where phase I stratification is based on Race.
##
# }
# NOT RUN {
tpsResult1 <- tpsPower(B=1000, beta=fitM$coef, X=XM, N=Ohio$N, strata=4,
nII=seq(from=100, to=1000, by=100),
betaNames=betaNamesM, monitor=100)
tpsResult1
# }
# NOT RUN {
## Power for the TPS design where phase I stratification is based on Age
## * consider the setting where the age coefficients are halved from
## their observed true values
## * the intercept is modified, accordingly, using the beta0() function
##
newBetaM <- fitM$coef
newBetaM[2:3] <- newBetaM[2:3] / 2
newBetaM[1] <- beta0(betaX=newBetaM[-1], X=XM, N=Ohio$N,
rhoY=sum(Ohio$Death)/sum(Ohio$N))
##
# }
# NOT RUN {
tpsResult2 <- tpsPower(B=1000, beta=fitM$coef, X=XM, N=Ohio$N, strata=2,
nII=seq(from=100, to=500, by=50),
betaNames=betaNamesM, monitor=100)
tpsResult2
# }
Run the code above in your browser using DataLab