Learn R Programming

speccurvieR (version 1.0.0)

plot_control_distributions: Plots control variable distributions.

Description

plot_control_distributions() plots the distribution of coefficients for each control variable included in the model specifications.

Usage

plot_control_distributions(
  sca_data,
  title = "",
  type = "density",
  zero_line = TRUE
)

Value

A ggplot object.

Arguments

sca_data

A data frame returned by `sca()` containing model estimates from the specification curve analysis.

title

A string to use as the plot title. Defaults to an empty string, `""`.

type

A string indicating what type of distribution plot to produce. When `type = "density"` density plots are produced. When `type = "hist"` or `type = "histogram"` histograms are produced. Defaults to `"density"`.

zero_line

A boolean indicating whether to draw a dashed reference line at zero, making it easy to see whether a control's effect crosses zero. Defaults to `TRUE`.

Examples

Run this code
plot_control_distributions(sca_data = sca(y="Salnty", x="T_degC",
                                    controls = c("ChlorA", "O2Sat"),
                                    data = bottles,
                                    progress_bar = TRUE, parallel = FALSE),
                         title = "Control Variable Distributions")
plot_control_distributions(sca_data = sca(y = "Salnty", x="T_degC",
                                    controls = c("ChlorA*O2Sat"),
                                    data = bottles,
                                    progress_bar = FALSE, parallel = FALSE),
                         type = "hist")
# \donttest{
plot_control_distributions(sca_data = sca(y = "Salnty", x = "T_degC",
                                    controls = c("ChlorA*NO3uM",
                                                 "O2Sat*NO3uM"),
                                    data = bottles, progress_bar = TRUE,
                                    parallel = TRUE, workers = 2),
                         type = "density")
# }

Run the code above in your browser using DataLab