Learn R Programming

conformalForecast

The R package conformalForecast provides methods and tools for performing multistep-ahead time series forecasting using conformal prediction methods including classical conformal prediction, adaptive conformal prediction, conformal PID control, and autocorrelated multistep-ahead conformal prediction.

Installation

You can install the development version of conformalForecast from GitHub with:

# install.packages("remotes")
remotes::install_github("xqnwang/conformalForecast")

You can also get the official release version from CRAN:

install.packages("conformalForecast")

Example

This is a basic example which shows you how to perform a classical conformal prediction method:

library(conformalForecast)
library(forecast)

# Simulate time series from an AR(2) model
series <- arima.sim(n = 1000, list(ar = c(0.8, -0.5)), sd = sqrt(1))

# Time series cross-validation
far2 <- function(x, h, level) {
  Arima(x, order = c(2, 0, 0)) |>
    forecast(h = h, level)
}
fc <- cvforecast(series, forecastfun = far2, h = 3, level = c(80, 95),
                 forward = TRUE, initial = 1, window = 100)

# Classical conformal prediction
scpfc <- scp(fc, symmetric = FALSE, ncal = 100, rolling = TRUE)

# Interval forecast accuracy
accuracy(scpfc, byhorizon = TRUE)

# Mean coverage
coverage(scpfc, window = 500, level = 95)

# Mean and median interval width
width(scpfc, window = 500, level = 95, includemedian = TRUE)

License

This package is free and open source software, licensed under GPL-3.

Copy Link

Version

Install

install.packages('conformalForecast')

Monthly Downloads

387

Version

0.1.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Xiaoqian Wang

Last Published

October 6th, 2025

Functions in conformalForecast (0.1.0)

update.cpforecast

Update and repeform cross-validation forecasting and conformal prediction
width

Calculate interval forecast width
scp

Classical split conformal prediction method
ME

Point estimate accuracy measures
lagmatrix

Create lags or leads of a matrix
MSIS

Interval estimate accuracy measures
accuracy.default

Accuracy measures for a cross-validation model and a conformal prediction model
pid

Conformal PID control method
conformal

Conformal prediction
acmcp

Autocorrelated multistep-ahead conformal prediction method
coverage

Calculate interval forecast coverage
cvforecast

Time series cross-validation forecasting
acp

Adaptive conformal prediction method
conformalForecast-package

conformalForecast: Conformal Prediction Methods for Multistep-Ahead Time Series Forecasting