plotPower {osDesign} | R Documentation |
Plot function for power, based on two-phase and case-control design
Description
The plotPower
function plots estimates of power obtained from objects returned by either the tpsPower
or ccPower
functions.
Usage
plotPower(x, coefNum=1, include="All", yAxis=seq(from=0, to=100, by=20),
xAxis=NULL, main=NULL, legendXY=NULL)
Arguments
x |
An object in a class |
coefNum |
A numeric vector number specifying the regression coefficient in |
include |
Character string indicating which estimators from a |
yAxis |
A scale marking the y-axis for the plot. |
xAxis |
A scale marking the x-axis for the plot. If left as the default |
main |
Title for the plot. |
legendXY |
Optional vector indicating the co-ordinates for the top-left hand corner of the legend box. |
Details
Produces a plot of statistical power (to reject a null hypothesis H0: beta = 0), for estimators of a regression coefficient from a logistic regression model, based on a two-phase and/or case-control design.
Author(s)
Sebastien Haneuse, Takumi Saegusa
References
Haneuse, S. and Saegusa, T. and Lumley, T. (2011) "osDesign: An R Package for the Analysis, Evaluation, and Design of Two-Phase and Case-Control Studies." Journal of Statistical Software, 43(11), 1-29.
See Also
Examples
##
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
##
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)
## Power
##
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]))