View source: R/analysis_helpers.R
| compute_zp | R Documentation |
Computes the per-period ZP quantile loss matrix based on the squared difference between the indicator of a tail event and the forecast's predicted probability of that event (Corradi & Swanson, 2006, eq. 7).
compute_zp(
forecast_matrix,
forecast_sd_models,
threshold,
benchmark_col = ncol(forecast_matrix)
)
forecast_matrix |
|
forecast_sd_models |
|
threshold |
|
benchmark_col |
Index or name of the benchmark column. Defaults to the last column. |
For each competing forecast k and period t:
ZP_{t,k} = \left(\mathbf{1}(y_t \leq \tau) -
\Phi\!\left(\frac{\tau - \hat{y}_{t,k}}{\hat{\sigma}_{t,k}}\right)\right)^2
where y_t is the realized value, \tau is the threshold,
\hat{y}_{t,k} is the point forecast, and \hat{\sigma}_{t,k} is the
forecast standard deviation. Lower ZP values are better.
Choosing \tau at the 5th percentile focuses evaluation on whether forecasts
correctly predict the risk of falling into the worst 5% of outcomes. The benchmark
column is assigned a point-mass predictive distribution (\hat{\sigma} = 10^{-6}),
which approximates the Brier score for the tail indicator and serves as a conservative
reference. When the benchmark is the Historical Average (HA), the ZP test thus
evaluates whether any competing forecast's calibrated tail probability outperforms the
HA's point prediction of the tail event.
matrix of dimension P x K_total containing ZP
loss values. Lower values indicate better left-tail probability calibration.
The benchmark column uses \hat{\sigma} = 10^{-6}.
Corradi, V., & Swanson, N. R. (2006). Predictive density and conditional confidence interval accuracy tests. Journal of Econometrics, 135(1–2), 187–228. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.jeconom.2005.07.026")}
Corradi, V., & Swanson, N. R. (2011). The White Reality Check and some of its recent extensions. In Festschrift in honor of Halbert L. White.
reality_check_zp_test,
estimate_forecast_variance
data(metals)
benchmark_col <- 15
K_total <- ncol(metals)
comp_cols <- setdiff(seq_len(K_total), benchmark_col)
forecast_variance <- estimate_forecast_variance(metals,
benchmark_col = benchmark_col)
forecast_sd_models <- sqrt(forecast_variance[, comp_cols])
threshold_val <- quantile(metals[, benchmark_col], 0.10)
zp_loss <- compute_zp(metals, forecast_sd_models,
threshold = threshold_val,
benchmark_col = benchmark_col)
head(zp_loss)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.