View source: R/exdqlmForecastDiagnostics.R
| exdqlmForecastDiagnostics | R Documentation |
Computes held-out forecast scores from one or two exdqlmForecast
objects returned by exdqlmForecast(). Unlike exdqlmDiagnostics(), which
summarizes fitted one-step-ahead forecast errors and their KL normality
diagnostics, this function evaluates posterior predictive forecast draws
against observations reserved outside the fitted sample.
exdqlmForecastDiagnostics(
m1,
m2 = NULL,
y,
p0 = NULL,
crps_probs = seq(0.01, 0.99, by = 0.01),
crps_weights = NULL
)
m1 |
An object of class " |
m2 |
An optional second object of class " |
y |
Numeric vector or time series of held-out observations. Its length must equal the forecast horizon. |
p0 |
Optional quantile level used for the check-loss calculation. When
|
crps_probs |
Numeric vector of quantile levels used to approximate CRPS
through the integrated quantile-score identity. Values must be strictly
between 0 and 1. Default is |
crps_weights |
Optional non-negative numeric weights for
|
The check loss is computed at the target quantile level p0 using the
forecast quantile means ff stored in each forecast object. CRPS is
computed from samp.fore using the same finite integrated quantile-score
approximation used by exdqlmDiagnostics(). This function does not compute
KL diagnostics because KL in exdqlm is defined for fitted
one-step-ahead MAP standardized forecast errors, not for arbitrary held-out
forecast draws.
An object of class "exdqlmForecastDiagnostic" containing:
y - Held-out observations used for scoring.
p0 - Quantile level used for check loss.
horizon - Forecast horizon.
m1.check_loss - Mean target-quantile check loss for
m1.
m1.CRPS - Mean CRPS approximation for m1.
m1.pointwise - Pointwise held-out scores for m1.
crps.method, crps.probs, and crps.weights -
CRPS approximation metadata.
If m2 is supplied, analogous m2.* fields are included.
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 15L)
y = scIVTmag[1:65]
y_train = y[1:60]
y_holdout = y[61:65]
model = polytrendMod(1, stats::quantile(y_train, 0.85), 10)
M0 = exdqlmLDVB(y_train, p0 = 0.85, model, df = c(0.98), dim.df = c(1),
gam.init = -3.5, sig.init = 15,
n.samp = 20, tol = 0.2, verbose = FALSE)
fFF = model$FF[, 1, drop = FALSE]
fGG = model$GG
M0.forecast = exdqlmForecast(start.t = 60, k = 5, m1 = M0,
fFF = fFF, fGG = fGG,
return.draws = TRUE, n.samp = 20, seed = 123,
plot = FALSE)
exdqlmForecastDiagnostics(M0.forecast, y = y_holdout)
options(old)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.