# 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

1 2 |

### 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

`tpsPower`

.

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | ```
##
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)
##
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))
## End(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]))
## End(Not run)
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.