predict_locs: predict_locs

View source: R/predict.R

predict_locsR Documentation

predict_locs

Description

Uses an existing model, such as developed by develop_model, to predict values a given locations and dates. Prepares the data necessary to do so. MAIAC, NARR, BlueSky, and (optionally) PurpleAir data should already be downloaded.

Usage

predict_locs(
  dt1,
  dt2,
  states = "CA",
  model,
  locations,
  pa_cutoff = 1e+05,
  bluesky_special = NULL,
  pa_data = NULL
)

Arguments

dt1

Date The earliest date of data to predict

dt2

Date The latest date to predict

states

character A vector of two-character state codes

model

A final model object, such as extracted from the results of develop_model. For example, if the object was called mod, this would be mod$model$finalModel

locations

A SpatialPointsDataFrame of locations (and dates) to predict

pa_cutoff

A cutoff value passed to vgm for interploation of PurpleAir data

bluesky_special

character Handles three special cases of BlueSky data. If "2020", processes data prior to October 10, 2020 separately from that after, as the BlueSky data format changed. If "HAQAST", uses custom BlueSky-CMAQ output created during the HAQAST campaign (see https://doi.org/10.1080/10962247.2021.1891994O'Neill et al., 2021). If "nominal", instead use a nominal placeholder value for BlueSky PM2.5 of 0.1, which will have a near neutral impact on predictions.

pa_data

PurpleAir data in pas-like format.

Value

A dataframe with all model input values and the resulting predictions for the locations and dates specified in locations

Examples

pred <- predict_locs(dt1, dt2, states = "CA", model = mod$model$finalModel,
                               locations = locs, pa_data = pa)

raffscallion/rapidfire documentation built on June 1, 2025, 2:04 p.m.