Learn R Programming

speccurvieR (version 0.4.2)

plotAIC: Plots the AIC across model specifications.

Description

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

Usage

plotAIC(sca_data, title = "", showIndex = TRUE, plotVars = TRUE)

Value

If `plotVars = TRUE` returns a grid grob (i.e. the output of a call to `grid.draw`). If `plotVars = FALSE` returns 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, `""`.

showIndex

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

plotVars

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
plotAIC(sca_data = sca(y = "Salnty", x = "T_degC",
                       controls = c("ChlorA", "O2Sat"),
                       data = bottles, progressBar = TRUE, parallel = FALSE),
                     title = "AIC");
plotAIC(sca_data = sca(y = "Salnty", x = "T_degC",
                       controls = c("ChlorA*O2Sat"),
                       data = bottles, progressBar = FALSE,
                       parallel = FALSE),
                       showIndex = FALSE, plotVars = FALSE);
plotAIC(sca_data = sca(y = "Salnty", x = "T_degC",
                         controls = c("ChlorA*NO3uM", "O2Sat*NO3uM"),
                         data = bottles,
                         progressBar = TRUE, parallel = TRUE, workers = 2));

Run the code above in your browser using DataLab