qra.Rd
Quantile Regression Average Calculates a quantile regression average for forecasts.
qra(
forecast,
target,
group = c(),
model = "Quantile Regression Average",
per_quantile_weights = FALSE,
enforce_normalisation = TRUE,
intercept = FALSE,
noncross = TRUE,
...
)
a data.table representing forecast; this is expected to
have been created using scoringutils::as_forecast_quantile()
the target for which to create the quantile regression
average. This should be given as a vector of form column = target
,
where target is the value of column that represents the target. Note that
the column named here cannot be a grouping variable.
any columns wihch to group a vector of character vectors (e.g.,
"horizon", "geography_scale", etc.) indicating columns in the
forecasts
and data
data frames; by default, will not group
anything, i.e. create one ensemble model
the name of the model to return; default: "Quantile Regression Average"
logical; whether to estimate weights per quantile
logical; whether to enforce quantiles
logical; whether to estimate and intercept
logical; whether ot enforce non-crosssing of quantiles
passed to quantgen::predict.quantile_ensemble()
; of particular
interest might be setting iso = TRUE
for isotonic regression
a data.table representing the forecasts forecast, but with
model
set to the value of the `model parameter. This will be in the
forecast format produced by scoringutils::as_forecast_quantile()
library("scoringutils")
#> scoringutils 2.0.0 introduces major changes. We'd love your feedback!
#> <https://github.com/epiforecasts/scoringutils/issues>. To use the old version,
#> run: `remotes::install_github('epiforecasts/scoringutils@v1.2.2')`
#> This message is displayed once per session.
example_quantile |>
as_forecast_quantile() |>
qra(
group = c("target_type", "location", "location_name"),
target = c(target_end_date = "2021-07-24")
)
#> ℹ Some rows containing NA values may be removed. This is fine if not
#> unexpected.
#> Forecast type: quantile
#> Forecast unit:
#> location, target_end_date, target_type, location_name, forecast_date, horizon,
#> and model
#>
#> quantile_level location target_end_date target_type location_name
#> <num> <char> <Date> <char> <char>
#> 1: 0.010 DE 2021-07-24 Cases Germany
#> 2: 0.010 DE 2021-07-24 Cases Germany
#> 3: 0.025 DE 2021-07-24 Cases Germany
#> 4: 0.025 DE 2021-07-24 Cases Germany
#> 5: 0.050 DE 2021-07-24 Cases Germany
#> ---
#> 364: 0.950 IT 2021-07-24 Deaths Italy
#> 365: 0.975 IT 2021-07-24 Deaths Italy
#> 366: 0.975 IT 2021-07-24 Deaths Italy
#> 367: 0.990 IT 2021-07-24 Deaths Italy
#> 368: 0.990 IT 2021-07-24 Deaths Italy
#> forecast_date horizon predicted observed model
#> <Date> <num> <num> <num> <char>
#> 1: 2021-07-05 3 688.0000 10616 Quantile Regression Average
#> 2: 2021-07-12 2 1821.0000 10616 Quantile Regression Average
#> 3: 2021-07-05 3 792.0000 10616 Quantile Regression Average
#> 4: 2021-07-12 2 2002.0000 10616 Quantile Regression Average
#> 5: 2021-07-05 3 913.0000 10616 Quantile Regression Average
#> ---
#> 364: 2021-07-12 2 246.3120 78 Quantile Regression Average
#> 365: 2021-07-05 3 208.4875 78 Quantile Regression Average
#> 366: 2021-07-12 2 278.7647 78 Quantile Regression Average
#> 367: 2021-07-05 3 245.7201 78 Quantile Regression Average
#> 368: 2021-07-12 2 317.7048 78 Quantile Regression Average