Description Usage Arguments Details See Also Examples
View source: R/09-ggstepp-plot-function.r
This function produces a plot of using the approach "Subpopulation Treatment Effect Pattern Plot". It shows the treatment effect size of subgroups, where subgruops are defined by certain ranges of a continuous covariate; each subgroup has a sample size close to a pre-specified value (N2) and any neighboring subgroups have an overlap size near another pre-specified value (N1). The plot shows the 95 a horizontal line). The y-coordinate of a point indicates the effect size within the corresponding subgroup; the x-coordinate shows the lower bound of the range which defines the subgroup. If part of the horizontal line is out of the simultaneous C.I., it may reveal hetergeneity across subgroup effects with repective to the overall effect. In addition, one can control the width of the C.I. by controlling Type I error rate in one of the function arguments. Note that the function uses log odd ratio and log hazard ratio for displaying subgroup effect sizes in binary and survival data, respectively. The actual subgroup sample sizes over the covariate are shown on the console window as well.
1 2 3 4 5 6 7 8 9 10 11 12 | ggplot_stepp(
dat,
covari.sel,
trt.sel,
resp.sel,
outcome.type,
setup.ss,
alpha,
title = NULL,
lab.y = NULL,
subtitle = NULL
)
|
dat |
a data set |
covari.sel |
a vector of indices of the two covariates |
trt.sel |
a variate index specifying the treatment code |
resp.sel |
a variate index specifying the response variable |
outcome.type |
a string specifying the type of the response variable, it can be "continuous", or "binary" or "survival". |
setup.ss |
a vector specifying the approximate overlap size (N2) and subgroup sample size (N1). |
alpha |
the type I error rate |
title |
a string specifying the main title. |
lab.y |
a string specifying the labels of the y-axis. |
subtitle |
strings specifying the subtitle |
Contrary to plot_stepp
, ggplot_stepp
implements the proper x-axis.
This function uses the ggplot2 package to draw the actual plot. To control font sizes, use theme
with the resulting object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # Load the data to be used
data(prca)
dat = prca
## 9. stepp Plot -----------------------------------------------------------
lab.y.title = paste("Treatment effect size (log-hazard ratio)");
setup.ss = c(30,40)
sub.title = paste0("(Subgroup sample sizes are set to ", setup.ss[2],
"; overlap sizes are set to ", setup.ss[1], ")" )
ggplot_stepp(dat,
covari.sel = 8,
trt.sel = 3,
resp.sel = c(1, 2),
outcome.type = "survival",
setup.ss = c(30,40),
alpha = 0.05,
title = NULL,
lab.y = lab.y.title,
subtitle = sub.title)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.