exactvartest
Fast exact finite-sample back-testing for Value-at-Risk (VaR) models in R.
Science Score: 39.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 1 DOI reference(s) in README -
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.8%) to scientific vocabulary
Keywords
backtesting-tools
dynamic-programming
exact-inference
risk-management
Last synced: 6 months ago
·
JSON representation
Repository
Fast exact finite-sample back-testing for Value-at-Risk (VaR) models in R.
Basic Info
Statistics
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
- Releases: 0
Topics
backtesting-tools
dynamic-programming
exact-inference
risk-management
Created 7 months ago
· Last pushed 6 months ago
Metadata Files
Readme
Changelog
License
README.Rmd
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# ExactVaRTest
Fast exact finite-sample back-testing for Value-at-Risk (VaR) models in R.
**ExactVaRTest** provides fast dynamic-programming algorithms in C++/Rcpp (with pure R fallbacks) for the exact finite-sample distributions and p-values of Christoffersen (1998) independence (IND) and conditional-coverage (CC) VaR backtests. For completeness, it also provides the exact unconditional-coverage (UC) test following Kupiec (1995) via a closed-form binomial enumeration.
In particular, it corrects the severe size distortions from which the usual asymptotic \(\chi^2\) approximation suffers in small samples and under extreme coverage rates.
* `backtest_lr()` returns the LR statistic, its exact p‑value, and a reject / fail‑to‑reject decision for one chosen test type (UC, IND, or CC).
* `backtest_all()` runs the UC, IND, and CC tests jointly and returns summaries for all three statistics.
## Installation
### CRAN
```r
install.packages("ExactVaRTest")
```
CRAN page: (https://CRAN.R-project.org/package=ExactVaRTest)
DOI: 10.32614/CRAN.package.ExactVaRTest
### GitHub (development)
```r
# install.packages("pak")
pak::pak("YujianCHEN219/ExactVaRTest")
```
## Example
```{r example}
library(ExactVaRTest)
set.seed(42)
x <- rbinom(300, 1, 0.03) # synthetic 0/1 exception series
bt <- backtest_lr(x, alpha = 0.05, type = "cc") # exact LR_cc back-test
print(bt)
```
## Main features
* Exact finite‑sample distributions and p‑values for LR\_ind and LR\_cc at any sample size *n*; for *n* ≤ 2000 the computation finishes in milliseconds to a few seconds.
* C++ implementation via `Rcpp`, with automatic fallback to a pure‑R reference engine.
* Minimal dependencies (`Rcpp`, `stats`); works on macOS, Linux, and Windows.
## Extensions
Freely extends to *CoVaR backtesting*: pass the institution’s hit sequence on system‑VaR‑breach days into `backtest_lr()` for exact UC/IND p‑values; for short windows or extreme tails, one option is to treat the systemic‑breach count as random and apply the mixture‑tail test to maintain correct size. (see vignettes and [Francq & Zakoïan 2025]).
## Suggested readings
1. Christoffersen, P. F. (1998). *Evaluating interval forecasts.* International economic review, 841-862.
2. Mehta, C. R., Patel, N. R., & Gray, R. (1985). *Computing an exact confidence interval for the common odds ratio in several 2× 2 contingency tables.* Journal of the American Statistical Association, 80(392), 969-973.
3. Francq, C., & Zakoïan, J. M. (2025). Inference on dynamic systemic risk measures. Journal of Econometrics, 247, 105936.
## Acknowledgements
I greatly appreciate Christian Francq, Christophe Hurlin, and Jean-Michel Zakoïan's guidance and support.
In particular, Christian Francq generously shared the initial idea; without his help, this package would not exist.
## License
This package is free and open source, licensed under GPL.
Owner
- Name: Yujian Chen
- Login: YujianCHEN219
- Kind: user
- Repositories: 1
- Profile: https://github.com/YujianCHEN219
GitHub Events
Total
- Push event: 1
Last Year
- Push event: 1
Packages
- Total packages: 1
-
Total downloads:
- cran 11 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 1
- Total maintainers: 1
cran.r-project.org: ExactVaRTest
Exact Finite-Sample Value-at-Risk Back-Testing
- Homepage: https://github.com/YujianCHEN219/ExactVaRTest
- Documentation: http://cran.r-project.org/web/packages/ExactVaRTest/ExactVaRTest.pdf
- License: GPL (≥ 3)
-
Latest release: 0.1.3
published 6 months ago
Rankings
Dependent packages count: 25.7%
Dependent repos count: 31.6%
Average: 47.5%
Downloads: 85.4%
Maintainers (1)
Last synced:
6 months ago
Dependencies
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v2 composite
- actions/upload-artifact main composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION
cran
- R >= 3.5.0 depends
- Rcpp * imports
- stats * imports
- bench * suggests
- dplyr * suggests
- ggplot2 * suggests
- knitr * suggests
- purrr * suggests
- quantmod * suggests
- rmarkdown * suggests
- testthat >= 3.0.0 suggests
- tidyr * suggests
- xts * suggests