For a given eBird Status and Trends species, produce a line plot showing the partial dependence (PD) relationship for a given predictor. Two options for smoothing are provided.

plot_pds(
pds,
predictor,
ext,
bootstrap_smooth = TRUE,
show_stixel_pds = FALSE,
show_quantiles = FALSE,
n_bs = 100,
ss_equivalent = 10,
k = 25,
ci_alpha = 0.05,
gbm_n_trees = 500,
ylim = NULL,
plot = TRUE
)

Arguments

pds

data frame; partial dependence data from load_pds().

predictor

character; single predictor name to plot PD for. For a full list of predictors, and their associated definitions, see ebirdst_predictors.

ext

ebirdst_extent object; the spatiotemporal extent over which to calculate PDs. This is required, since results are less meaningful over large spatiotemporal extents.

bootstrap_smooth

logical; the ideal visualization of the PD data is a pointwise GAM smoothing of the individual stixel PD values. This argument specifies whether this should be done directly on the full PD dataset (bootstrap_smooth = FALSE) or by subsampling and bootstrapping. The latter approach deals with the randomness in the data and can be more efficient for large datasets.

show_stixel_pds

logical; whether to plot the individual stixel PD values as semi-transparent lines.

show_quantiles

logical; adds a band for the upper (90th) and lower (10th) quantiles of the individual stixel PD values. These are calculated using quantile regression.

n_bs

int; number of GAM bootstrap iterations when estimating PD confidence intervals. Ignored if bootstrap_smooth = FALSE.

ss_equivalent

int; when bootstrapping to estimate PD confidence intervals, this argument specifies the size of the subsample of the original data. In particular, ss_equivalent should be an integer representing the equivalent sampling size when averaging this number of PD estimates.

k

integer; number of knots to use in the GAM when smooth the PD relationship.

ci_alpha

numeric; alpha level of confidence intervals. Default is 0.05.

gbm_n_trees

integer; number of trees to fit in the GBM when estimating quantiles. Ignored if show_quantiles = FALSE. Default is 500.

ylim

numeric; 2-element vector to pre-define the y-limits of plotting. In the format c(ymin, ymax).

plot

logical; whether to plot the PD relationships or just return data.

Value

Plots the smoothed partial dependence relationship for the specified predictor and returns a data frame of the smoothed curve with confidence intervals.

Examples

if (FALSE) {
path <- get_species_path("example_data")