Learn R Programming

speccurvieR (version 1.0.0)

plot_aic: Plots the AIC across model specifications.

Description

plot_aic() plots the Akaike information criterion across model specifications. Only available for nonlinear regression models.

Usage

plot_aic(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_aic(sca_data = sca(y = "Salnty", x = "T_degC",
                       controls = c("ChlorA", "O2Sat"),
                       data = bottles, progress_bar = TRUE, parallel = FALSE),
                     title = "AIC");
plot_aic(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_aic(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