qarPI

The package provides prediction intervals (PIs) under two model classes:

A central feature of the package is the implementation of the new bootstrap algorithms AR-perc, AR-proot, QAR-perc, and QAR-proot, introduced in the article “Prediction Intervals for Quantile Autoregression” (arXiv:2512.22018).

In addition, the package includes several established bootstrap and analytical procedures (Box-Jenkins) from the existing literature, allowing users to replicate and compare alternative PI constructions within a unified framework.

Within each model class, bootstrap PIs may therefore be obtained via:


Installation

# install the package
# devtools::install_github("SilviaNovo/qarPI")
install.packages("qarPI", repos = c('https://silvianovo.r-universe.dev', 'https://cloud.r-project.org'))


#load the package
library(qarPI)

1. PI methods for AR(p) models

Percentile-based bootstrap PIs

Bootstrap procedures constructed under the AR(p) framework using the percentile principle

set.seed(123)
y <- arima.sim(model = list(ar = 0.6), n = 300)

# AR-perc PI
pi <- pi_AR_perc(y, p = 1, h = 3)

t_PI <- data.frame(
  Lower = pi$lpi,
  Upper = pi$upi,
  Length = pi$len
)
t_PI
##       Lower    Upper   Length
## 1 -1.849219 1.828965 3.678184
## 2 -2.122772 2.202761 4.325532
## 3 -2.171773 2.409590 4.581363
# Thombs & Schucany PI
pi <- pi_TS(y, p = 1, h = 3)

t_PI <- data.frame(
  Lower = pi$lpi,
  Upper = pi$upi,
  Length = pi$len
)
t_PI
##       Lower    Upper   Length
## 1 -1.809166 1.961925 3.771091
## 2 -2.062066 2.340589 4.402655
## 3 -2.116774 2.275783 4.392557
# Cao et al. PI
pi <- pi_CB(y, p = 1, h = 3)

t_PI <- data.frame(
  Lower = pi$lpi,
  Upper = pi$upi,
  Length = pi$len
)
t_PI
##       Lower    Upper   Length
## 1 -1.819219 1.889094 3.708313
## 2 -2.085047 2.205806 4.290853
## 3 -2.068545 2.460602 4.529146
# Pascual et al. PI. OLS
pi <- pi_PRR(y, p = 1, h = 3, method="OLS")

t_PI <- data.frame(
  Lower = pi$lpi,
  Upper = pi$upi,
  Length = pi$len
)
t_PI
##       Lower    Upper   Length
## 1 -1.866294 1.906787 3.773081
## 2 -2.003852 2.309888 4.313740
## 3 -2.116450 2.481027 4.597478
# Pascual et al. PI. LAD
pi <- pi_PRR(y, p = 1, h = 3, method="LAD")

t_PI <- data.frame(
  Lower = pi$lpi,
  Upper = pi$upi,
  Length = pi$len
)
t_PI
##       Lower    Upper   Length
## 1 -1.883711 1.882117 3.765828
## 2 -1.993665 2.283575 4.277240
## 3 -2.159428 2.409537 4.568965

Predictive-root-based bootstrap PIs

Bootstrap intervals constructed using the predictive root approach

# AR-proot PI
pi <- pi_AR_proot(y, p = 1, h = 3)

t_PI <- data.frame(
  Lower = pi$lpi,
  Upper = pi$upi,
  Length = pi$len
)
t_PI
##       Lower    Upper   Length
## 1 -1.778688 1.944880 3.723568
## 2 -2.063616 2.239408 4.303024
## 3 -2.043930 2.589753 4.633683
# Pan & Politis PI
pi <- pi_PP(y, p = 1, h = 3)

t_PI <- data.frame(
  Lower = pi$lpi,
  Upper = pi$upi,
  Length = pi$len
)
t_PI
##       Lower    Upper   Length
## 1 -1.848580 1.952997 3.801577
## 2 -2.159115 2.209435 4.368550
## 3 -2.162428 2.142813 4.305242

Analytical PIs: Box-Jenkins

# Classical Box–Jenkins PI
pi <- pi_BJ(y, p = 1, h = 3)

t_PI <- data.frame(
  Lower = pi$lpi,
  Upper = pi$upi,
  Length = pi$len
)
t_PI
##       Lower    Upper   Length
## 1 -2.023091 1.737312 3.760403
## 2 -2.205069 2.090839 4.295908
## 3 -2.232970 2.213495 4.446464


2. PI methods for QAR(p) models

Prediction intervals constructed under the QAR(p) framework


Percentile-based bootstrap PIs

# QAR-perc PI
pi <- pi_QAR_perc(y, p = 1, h = 3)

t_PI <- data.frame(
  Lower = pi$lpi,
  Upper = pi$upi,
  Length = pi$len
)
t_PI
##       Lower    Upper   Length
## 1 -1.858576 1.860805 3.719380
## 2 -2.137675 2.037932 4.175606
## 3 -2.113105 2.394030 4.507136
# Xiao PI
pi <- pi_X(y, p = 1, h = 3)

t_PI <- data.frame(
  Lower = pi$lpi,
  Upper = pi$upi,
  Length = pi$len
)
t_PI
##       Lower    Upper   Length
## 1 -1.836173 1.916079 3.752252
## 2 -2.066253 2.279619 4.345872
## 3 -2.163826 2.320773 4.484599

Predictive-root-based bootstrap PIs

# QAR-proot PI
pi <- pi_QAR_proot(y, p = 1, h = 3)

t_PI <- data.frame(
  Lower = pi$lpi,
  Upper = pi$upi,
  Length = pi$len
)
t_PI
##       Lower    Upper   Length
## 1 -1.826982 1.894856 3.721838
## 2 -2.051728 2.082905 4.134633
## 3 -2.047210 2.464404 4.511614

Summary Structure

qarPI
│
├── AR(p)
│   ├── Percentile-based Bootstrap
│   │   ├── AR-perc → pi_AR_perc()
│   │   ├── TS → pi_TS()
│   │   ├── CB → pi_CB()
│   │   └── PRR → pi_PRR()
│   │
│   ├── Predictive-root-based Bootstrap
│   │   ├── AR-proot → pi_AR_proot()
│   │   └── PP (Fp) → pi_PP()
│   │
│   └── Analytical
│       └── BJ → pi_BJ()
│
└── QAR(p)
    ├── Percentile-based Bootstrap
    │   ├── QAR-perc → pi_QAR_perc()
    │   └── X → pi_X()
    │
    └── Predictive-root-based Bootstrap
        └── QAR-proot → pi_QAR_proot()

References