plane_score {rplanes} | R Documentation |
Score PLANES components
Description
This function wraps PLANES scoring for specified components across all locations in single step.
Usage
plane_score(input, seed, components = "all", args = NULL, weights = NULL)
Arguments
input |
Input signal data to be scored; object must be one of forecast or observed |
seed |
Prepared seed |
components |
Character vector specifying component; must be either |
args |
Named list of arguments for component functions. List elements must be named to match the given component and arguments passed as a nested list (e.g., |
weights |
Named vector with weights to be applied; default is |
Value
A list
with scoring results for all locations.
Examples
## read in example observed data and prep observed signal
hosp <- read.csv(system.file("extdata/observed/hdgov_hosp_weekly.csv", package = "rplanes"))
hosp$date <- as.Date(hosp$date, format = "%Y-%m-%d")
prepped_observed <- to_signal(hosp, outcome = "flu.admits", type = "observed", resolution = "weeks")
## read in example forecast and prep forecast signal
fp <- system.file("extdata/forecast/2022-10-31-SigSci-TSENS.csv", package = "rplanes")
prepped_forecast <- read_forecast(fp) %>%
to_signal(., outcome = "flu.admits", type = "forecast", horizon = 4)
## prepare seed with cut date
prepped_seed <- plane_seed(prepped_observed, cut_date = "2022-10-29")
## run plane scoring with all components
plane_score(input = prepped_forecast, seed = prepped_seed)
## run plane scoring with select components
plane_score(input = prepped_forecast, seed = prepped_seed, components = c("cover","taper"))
## run plane scoring with all components and additional args
trend_args <- list("sig_lvl" = 0.05)
repeat_args <- list("prepend" = 4, "tolerance" = 8)
shape_args <- list("method" = "dtw")
comp_args <- list("trend" = trend_args, "repeat" = repeat_args, "shape" = shape_args)
plane_score(input = prepped_forecast, seed = prepped_seed, args = comp_args)
## run plane scoring with specific components and weights
comps <- c("cover", "taper", "diff")
wts <- c("cover" = 1.5, "taper" = 1, "diff" = 4)
plane_score(input = prepped_forecast, seed = prepped_seed, components = comps, weights = wts)