plotR2Adj: Plots the adj. R-squared across model specifications.

View source: R/functions.R

plotR2AdjR Documentation

Plots the adj. R-squared across model specifications.

Description

plotR2Adj() plots the adjusted R-squared across model specifications. Only available for linear regression models. Note when fixed effects are are specified the within adjusted R-squared is used (i.e. 'fixest::r2()' with 'type="war2"').

Usage

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

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'.

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.

Examples

plotR2Adj(sca_data = sca(y = "Salnty", x = "T_degC",
                         controls = c("ChlorA", "O2Sat"),
                         data = bottles, progressBar = TRUE,
                         parallel = FALSE),
                     title = "Adjusted R^2");
plotR2Adj(sca_data = sca(y="Salnty", x="T_degC",
                         controls = c("ChlorA*O2Sat"),
                         data = bottles, progressBar = FALSE,
                         parallel = FALSE),
                     showIndex = FALSE, plotVars = FALSE);
plotR2Adj(sca_data = sca(y = "Salnty", x = "T_degC",
                         controls = c("ChlorA*NO3uM", "O2Sat*NO3uM"),
                         data = bottles,
                         progressBar = TRUE, parallel = TRUE, workers = 2));

speccurvieR documentation built on Oct. 10, 2024, 1:08 a.m.