
Create partial dependence plots for deweather models
Source:R/plot_dw_partial_1d.R
plot_dw_partial_1d.RdGenerates partial dependence plots to visualize the relationship between predictor variables and model predictions. These plots show how the predicted pollutant concentration changes as a function of one variable while averaging over the effects of all other variables.
Usage
plot_dw_partial_1d(
dw,
vars = NULL,
intervals = 40L,
group = NULL,
group_intervals = 3L,
show_conf_int = TRUE,
n = NULL,
prop = 0.1,
cols = "tol",
radial_wd = TRUE,
ncol = NULL,
nrow = NULL,
plot = TRUE,
progress = rlang::is_interactive()
)Arguments
- dw
A deweather model created with
build_dw_model().- vars
Character. The name of the variable(s) to plot. Must be one of the variables used in the model. If
NULL, all variables will be plotted in order of importance.- intervals
The number of points for the partial dependence profile.
- group
Optional grouping variable to show separate profiles for different levels of another predictor. Must be one of the variables used in the model. Default is
NULL(no grouping).- group_intervals
The number of bins when the
groupvariable is numeric.- show_conf_int
Should the bootstrapped 95% confidence interval be shown? In
plot_dw_partial_1d()these are shown using transparent ribbons (for numeric variables) and rectangles (for categorical variables).- n
The number of observations to use for calculating the partial dependence profile. If
NULL(default), usespropto determine the sample size.- prop
The proportion of input data to use for calculating the partial dependence profile, between 0 and 1. Default is
0.1(10% of data). Ignored ifnis specified.- cols
Colours to use for plotting. See
openair::openColours().- radial_wd
Should the
"wd"(wind direction) variable be plotted on a radial axis? This can enhance interpretability, but makes it inconsistent with other variables which are plotted on cartesian coordinates. Defaults toTRUE.- ncol, nrow
When more than one
varsis defined,ncolandnrowdefine the dimensions of the grid to create. Setting both to beNULLcreates a roughly square grid.- plot
When
FALSE, return a list of plot data instead of a plot.- progress
Show a progress bar? Defaults to
TRUEin interactive sessions.