| coverage | R Documentation |
Calculate the mean coverage and the ifinn matrix for the prediction
intervals on the validation set. If window is not NULL, a
matrix of the rolling means of the interval forecast coverage is also
returned.
coverage(object, ..., level = 95, window = NULL, na.rm = FALSE)
object |
An object of class |
... |
Arguments |
level |
Target confidence level for the prediction intervals. Only one
level can be specified. Defaults to |
window |
If not |
na.rm |
A logical indicating whether |
A list of class "coverage" with the following components:
mean |
Mean coverage across the validation set. |
ifinn |
An indicator matrix as a multivariate time series, where the
|
rollmean |
If |
cvforecast and the conformal methods, which produce
object.
Other evaluation functions:
accuracy.cvforecast(),
width()
# Simulate time series from an AR(2) model
library(forecast)
set.seed(1)
series <- arima.sim(n = 200, list(ar = c(0.8, -0.5)), sd = sqrt(1))
# Cross-validation forecasting with a rolling window
far2 <- function(x, h, level) {
Arima(x, order = c(2, 0, 0)) |>
forecast(h = h, level)
}
fc <- cvforecast(series, forecastfun = far2, h = 3, level = 95, window = 50)
# Mean and rolling mean coverage for interval forecasts on validation set
cov_fc <- coverage(fc, level = 95, window = 50)
str(cov_fc)
# Coverage calculated directly from interval components
coverage(x = fc$x, LOWER = fc$LOWER, UPPER = fc$UPPER, level = 95)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.