View source: R/selection_plot.R
| selection_plot | R Documentation |
For a fitted model of class "selmodel", create a plot of
the selection weights implied by the model parameter estimates. If the
model includes bootstrapped confidence intervals, then the plot will also
display the selection weights implied by each bootstrap replicate of the
parameter estimates.
selection_plot(
mod,
limits = c(0, 1),
pts = 200L,
ref_pval = NULL,
transform = "identity",
expand = ggplot2::expansion(0, 0.01),
...
)
## S3 method for class 'selmodel'
selection_plot(
mod,
limits = c(0, 1),
pts = 200L,
ref_pval = NULL,
transform = "identity",
expand = ggplot2::expansion(0, 0.01),
fill = "blue",
alpha = 0.5,
step_linetype = "dashed",
...
)
## S3 method for class 'boot.selmodel'
selection_plot(
mod,
limits = c(0, 1),
pts = 200L,
ref_pval = NULL,
transform = "identity",
expand = ggplot2::expansion(0, 0.01),
color = "black",
linewidth = 1.2,
step_linetype = "dashed",
draw_boots = TRUE,
fill = "blue",
alpha = 0.5,
boot_color = "blue",
boot_alpha = 0.1,
...
)
mod |
fitted model of class |
limits |
numeric vector of length 2 specifying the minimum and maximum p-values to plot. |
pts |
number of points for which to calculate selection weights, with a default of 200 points, evenly spaced between the specified limits. |
ref_pval |
numeric value of a p-value at which to standardize the
weights. If not |
transform |
character string specifying the name of a transformation function or the transformation function itself, as defined in the scales package. The transform is passed to |
expand |
passed to the |
... |
further arguments passed to |
fill |
character string specifying the fill-color to use when |
alpha |
numeric value specifying the opacity of the filled area plot,
with a default of 0.5. Passed to |
step_linetype |
character string specifying the type of line to draw to
indicate p-value thresholds assumed in |
color |
character string specifying the line color to use for drawing
the estimated selection weights, with a default of |
linewidth |
numeric value specifying the line width to use for drawing
the estimated selection weights, with a default of 1.2. Passed to
|
draw_boots |
logical value indicating whether to draw the selection
weights for each bootstrap replication, with a default of |
boot_color |
character string specifying the line color to use for
drawing the selection weights of each bootstrap replication, with a default
of |
boot_alpha |
numeric value specifying the opacity of the lines for
drawing the selection weights of each bootstrap replication, with a default
of |
A ggplot2 object.
mod <- selection_model(
data = self_control,
yi = g,
sei = se_g,
cluster = studyid,
steps = c(0.025, .5),
estimator = "ARGL",
bootstrap = "none"
)
selection_plot(mod, fill = "purple")
# rescale the horizontal axis using arc-sin square root
selection_plot(mod, fill = "purple", transform = "asn")
mod_boot <- selection_model(
data = self_control,
yi = g,
sei = se_g,
cluster = studyid,
steps = c(0.025, .5),
estimator = "ARGL",
bootstrap = "multinomial",
CI_type = "percentile",
R = 9L
)
selection_plot(mod_boot, transform = "sqrt")
selection_plot(mod_boot, transform = "sqrt", draw_boots = FALSE) # turn off bootstrap lines
selection_plot(mod_boot, transform = "sqrt", color = "red", boot_color = "orange") # change colors
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.