Learn R Programming

speccurvieR (version 1.0.0)

plot_deviance: Plots the deviance of residuals across model specifications.

Description

plot_deviance() plots the deviance of residuals across model specifications. Only available for linear regression models.

Usage

plot_deviance(sca_data, title = "", show_index = TRUE, plot_vars = TRUE)

Value

If `plot_vars = TRUE` a `patchwork` object combining the plot and the variable panel; if `plot_vars = FALSE` 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, `""`.

show_index

A boolean indicating whether to label the model index on the the x-axis. Defaults to `TRUE`.

plot_vars

A boolean indicating whether to include a panel on the plot showing which variables are present in each model. Defaults to `TRUE`.

Examples

Run this code
plot_deviance(sca_data = sca(y = "Salnty", x = "T_degC",
                            controls = c("ChlorA", "O2Sat"),
                            data = bottles, progress_bar = TRUE,
                            parallel = FALSE),
                     title = "Model Deviance");
plot_deviance(sca_data = sca(y = "Salnty", x = "T_degC",
                            controls = c("ChlorA*O2Sat"),
                            data = bottles, progress_bar = FALSE,
                            parallel = FALSE),
                     show_index = FALSE, plot_vars = FALSE);
# \donttest{
plot_deviance(sca_data = sca(y = "Salnty", x="T_degC",
                         controls = c("ChlorA*NO3uM", "O2Sat*NO3uM"),
                         data = bottles, progress_bar = TRUE, parallel = TRUE,
                         workers = 2));
# }

Run the code above in your browser using DataLab