View source: R/analysis_helpers.R
| compute_klic | R Documentation |
Computes the per-period Negative Log-Likelihood Score (NLS) loss matrix under a Gaussian predictive density assumption. The NLS is the loss function corresponding to minimisation of the Kullback-Leibler Information Criterion (KLIC) distance from the true density (Corradi & Swanson, 2006).
compute_klic(
forecast_matrix,
forecast_sd_models,
benchmark_col = ncol(forecast_matrix)
)
forecast_matrix |
|
forecast_sd_models |
|
benchmark_col |
Index or name of the benchmark column. Defaults to the last column. |
For each competing forecast k and period t:
NLS_{t,k} = -\log \phi(y_t \mid \hat{y}_{t,k},\, \hat{\sigma}_{t,k})
where \phi denotes the Gaussian density, y_t is the realized value,
\hat{y}_{t,k} is the point forecast, and \hat{\sigma}_{t,k} is the
forecast standard deviation. Minimising the average NLS is equivalent to minimising
the KLIC distance between the forecast's predictive density and the true density
(Corradi & Swanson, 2006). Lower NLS values are better. The benchmark
column in the returned matrix is set to zero.
matrix of dimension P x K_total containing NLS
values. Lower values indicate better density forecast accuracy. The benchmark
column is set to zero.
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.
kullback_leibler_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])
klic_loss <- compute_klic(metals, forecast_sd_models,
benchmark_col = benchmark_col)
head(klic_loss)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.