View source: R/exdqlmForecast_methods.R
| diagnostics.exdqlmForecast | R Documentation |
exdqlmForecast ObjectsComputes held-out forecast scores from one or two exdqlmForecast
objects, typically returned by predict.exdqlmFit or
exdqlmForecast with return.draws = TRUE. This method
evaluates posterior predictive forecast draws against observations reserved
outside the fitted sample.
## S3 method for class 'exdqlmForecast'
diagnostics(
object,
y,
m2 = NULL,
p0 = NULL,
crps_probs = seq(0.01, 0.99, by = 0.01),
crps_weights = NULL,
...
)
object |
An |
y |
Required numeric vector or time series of held-out observations. Its length must equal the forecast horizon. |
m2 |
An optional second object of class " |
p0 |
Optional quantile level used for the check-loss calculation. When
|
crps_probs |
Optional 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
|
... |
Additional arguments (unused). |
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 = predict(M0, start.t = 60, k = 5,
fFF = fFF, fGG = fGG,
return.draws = TRUE, n.samp = 20, seed = 123,
plot = FALSE)
score = diagnostics(M0.forecast, y = y_holdout)
score
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.