Append lpd, (C)RPS and predictive samples to (test) dataframe
Source:R/validation.R
add_predictions.Rd
Append lpd, (C)RPS and predictive samples to (test) dataframe
Arguments
- df
Dataframe. When
discrete = FALSE
, it must contain a column "Score".- fit
Stanfit object
- discrete
Whether to estimate a discrete or continuous forecast. For a discrete forecast, the RPS will be computed and the CRPS for a continuous forecast.
- include_samples
Whether to return samples from the historical forecast in the output
- n_samples
If
include_samples=TRUE
, how many samples to return. Default (=NULL) to all samples.
Value
Dataframe df
appended by the columns "lpd", "RPS" (or CRPS if discrete=FALSE
) and optionally "Samples"