# 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 Age
##
newBetaM <- fitM$coef
newBetaM[2:3] <- newBetaM[2:3] / 2
##
# }
# NOT RUN {
powerRaceTPS <- tpsPower(B=10000, betaTruth=fitM$coef, X=XM, N=Ohio$N,
strata=4,
nII=seq(from=100, to=1000, by=100),
betaNames=c("Int", "Age1", "Age2", "Sex", "Race"), monitor=1000)
##
old.par <- par()
par(mfrow=c(2,2))
plotPower(powerRaceTPS, include="TPS", coefNum=2,
xAxis=seq(from=100, to=1000, by=100),
main=expression("Age effect (65-74 vs. 55-64 years), " * beta[A1]),
legendXY=c(800, 65))
plotPower(powerRaceTPS, include="ML", coefNum=2,
xAxis=seq(from=100, to=1000, by=100),
main=expression("Age effect (65-74 vs. 55-64 years), " * beta[A1]),
legendXY=c(800, 65))
plotPower(powerRaceTPS, include="WL", coefNum=2,
xAxis=seq(from=100, to=1000, by=100),
main=expression("Age effect (65-74 vs. 55-64 years), " * beta[A1]),
legendXY=c(800, 65))
plotPower(powerRaceTPS, include="CC", coefNum=2,
xAxis=seq(from=100, to=1000, by=100),
main=expression("Age effect (65-74 vs. 55-64 years), " * beta[A1]),
legendXY=c(800, 65))
##
par(old.par)
# }
# NOT RUN {
## Power
##
# }
# NOT RUN {
ccResult <- ccPower(B=1000, betaTruth=newBetaM, X=XM, N=Ohio$N, r=0.5,
nCC=seq(from=100, to=500, by=50), betaNames=betaNamesM,
monitor=100)
##
par(mfrow=c(2,2))
plotPower(ccResult, coefNum=2, yAxis=seq(from=0, to=100, by=20),
xAxis=seq(from=100, to=500, by=100),
main=expression("Age effect (65-74 vs. 55-64 years), " * beta[A1]))
plotPower(ccResult, coefNum=3, yAxis=seq(from=0, to=100, by=20),
xAxis=seq(from=100, to=500, by=100),
main=expression("Age effect (75-84 vs. 55-64 years), " * beta[A2]))
plotPower(ccResult, coefNum=4, yAxis=seq(from=0, to=100, by=20),
xAxis=seq(from=100, to=500, by=100),
main=expression("Sex effect, " * beta[S]))
plotPower(ccResult, coefNum=5, yAxis=seq(from=0, to=100, by=20),
xAxis=seq(from=100, to=500, by=100),
main=expression("Race effect, " * beta[R]))
# }
Run the code above in your browser using DataLab