Christoffersen Independence Test for VaR backtesting
Project description
christoffersen-lib
Python library for the Christoffersen Independence Test, used in VaR (Value at Risk) backtesting in quantitative finance.
Installation
pip install christoffersen-lib
Usage
from christoffersen import independence_test
violations = [0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0]
lr, p_value = independence_test(violations)
print(f"LR statistic : {lr:.4f}")
print(f"P-value : {p_value:.4f}")
if p_value > 0.05:
print("✅ Independence not rejected (violations are not clustered)")
else:
print("❌ Independence rejected (violations are clustered — bad VaR model)")
Interpretation
| P-value | Conclusion |
|---|---|
| > 0.05 | VaR model passes the independence test |
| ≤ 0.05 | Violations are clustered — model underestimates tail risk |
Parameters
independence_test(violations)
violations: list or numpy array of 0s and 1s — 1 means the VaR was exceeded on that day
Returns (lr_statistic, p_value).
Dependencies
- numpy
- scipy
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file christoffersen_lib-0.1.8.tar.gz.
File metadata
- Download URL: christoffersen_lib-0.1.8.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f18f286d168b261774028d09b00641f90630728d8268fa64ea3ad517c67f7b22
|
|
| MD5 |
1fc84ce5e868fc9d7c2ed1dcee0d8b64
|
|
| BLAKE2b-256 |
264d1ecdb15c1110a1b2cc457650bb66906f0b5a04f956ce0f2df180f6bfbbc0
|
File details
Details for the file christoffersen_lib-0.1.8-py3-none-any.whl.
File metadata
- Download URL: christoffersen_lib-0.1.8-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
baa56da55fedfe3ab064cefa536e7cbbcf80037f4f3416b1c25c3685300277eb
|
|
| MD5 |
159afc6e2efb621b75d06d2418af1a68
|
|
| BLAKE2b-256 |
53cc6289073ea6996b3174ca60ebd09519e36f2c9dea6982d161bae0eba8774a
|