| conformal | R Documentation |
This function allows you to specify the method used to perform conformal prediction.
conformal(object, ...)
## S3 method for class 'cvforecast'
conformal(object, method = c("scp", "acp", "pid", "acmcp"), ...)
object |
An object of class |
... |
Additional arguments to be passed to the selected conformal method. |
method |
A character string specifying the conformal method to be
applied. Possible options include |
An object whose class depends on the method invoked.
cvforecast to produce object, and
update.cpforecast to extend the results with new
observations.
Other conformal prediction methods:
acmcp(),
acp(),
pid(),
scp()
# 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
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)
# Classical conformal prediction with equal weights
scpfc <- conformal(fc, method = "scp", ncal = 50, rolling = TRUE)
summary(scpfc)
# ACP with asymmetric nonconformity scores and rolling calibration sets
acpfc <- conformal(fc, method = "acp", gamma = 0.005,
ncal = 50, rolling = TRUE)
summary(acpfc)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.