View source: R/stratWO_data_frame.R
stratWO.data.frame | R Documentation |
Stratified win odds with adjustment
## S3 method for class 'data.frame'
stratWO(
x,
AVAL,
TRTP,
STRATA,
ref,
COVAR = NULL,
alpha = 0.05,
WOnull = 1,
...
)
x |
a data frame containing subject-level data. |
AVAL |
variable in the data with ordinal analysis values. |
TRTP |
the treatment variable in the data. |
STRATA |
a character variable for stratification. |
ref |
the reference treatment group. |
COVAR |
a numeric covariate. |
alpha |
the reference treatment group. |
WOnull |
the null hypothesis. The default is 1. |
... |
additional parameters. |
a data frame containing the following columns:
WO stratified (or adjusted/stratified) win odds.
LCL lower confidence limit for adjusted (or adjusted/stratified) WO.
UCL upper confidence limit for adjusted (or adjusted/stratified) WO.
SE standard error of the adjusted (or adjusted/stratified) win odds.
WOnull win odds of the null hypothesis (specified in the WOnull
argument).
alpha two-sided significance level for calculating the confidence interval (specified in the alpha
argument).
Pvalue p-value associated with testing the null hypothesis.
WP adjusted (or adjusted/stratified) win probability.
LCL_WP lower confidence limit for adjusted (or adjusted/stratified) WP.
UCL_WP upper confidence limit for adjusted (or adjusted/stratified) WP.
SE_WP standard error for the adjusted (or adjusted/stratified) win probability.
SD_WP standard deviation of the adjusted (or adjusted/stratified) win probability.
N total number of patients in the analysis.
Type "STRATIFIED" or "STRATIFIED/ADJUSTED" depending on whether COVAR
is specified.
Gasparyan SB et al. (2021) "Adjusted win ratio with stratification: calculation methods and interpretation." Statistical Methods in Medical Research 30.2: 580-611. doi:10.1177/0962280220942558.
stratWO()
.
# Stratified win odds
res <- stratWO(x = KHCE, AVAL = "AVAL", TRTP = "TRTP",
STRATA = "STRATAN", ref = "P")
res
## Compare with the non-stratified win odds
res0 <- calcWO(AVAL ~ TRTP, data = KHCE, ref = "P")
res0
## Compare with the win odds in each stratum separately
l <- lapply(split(KHCE, KHCE$STRATAN), calcWO, AVAL = "AVAL", TRTP = "TRTP", ref = "P")
l <- do.call(rbind, l)
l <- l[, c("WO", "LCL", "UCL", "N")]
l$STRATA <- as.numeric(row.names(l))
plot(y = l$WO, x = l$STRATA, ylim = c(0.5, 2.5), log = "y", xlim = c(0, 6),
ylab = "Win Odds", xlab = "", xaxt = "n")
axis(1, at = 1:6, labels = c(paste0("STR = ", l$STRATA), "Stratified", "Non-stratified"))
arrows(l$STRATA, l$LCL, l$STRATA,
l$UCL, angle = 90, code = 3, length = 0.05, col = "darkgreen")
points(5, res$WO)
arrows(5, res$LCL, 5, res$UCL, angle = 90, code = 3,
length = 0.05, col = "darkblue")
abline(h = c(1, res$WO), col = "red", lty = 4)
points(6, res0$WO)
arrows(6, res0$LCL, 6, res0$UCL, angle = 90, code = 3,
length = 0.05, col = "darkred")
# Stratified and adjusted win odds
res <- stratWO(x = KHCE, AVAL = "AVAL", COVAR = "EGFRBL",
TRTP = "TRTP", STRATA = "STRATAN", ref = "P")
res
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.