Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

christoffersen_lib-0.1.1.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

christoffersen_lib-0.1.1-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file christoffersen_lib-0.1.1.tar.gz.

File metadata

  • Download URL: christoffersen_lib-0.1.1.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for christoffersen_lib-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7f9077e45e168756647a4f08568dfaf4a2b1ba7517e5349ab19ca2cb2513b88d
MD5 462d992f8814bb781987c87fd7923342
BLAKE2b-256 c4bf175fc25e5574504ffab0ecd4666e4f3b39b2fb3fcaf8b871bc884c6fb46f

See more details on using hashes here.

File details

Details for the file christoffersen_lib-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for christoffersen_lib-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dac56ae7e5b0150b8e75002007ea1a0b6f5277dc41c99fed9a20022b2594f646
MD5 9428eceb8f06a781ed053de52638e1ff
BLAKE2b-256 c15c4e43a9594e504c0d4093b9174f9510efe61376b689bfdd127408de0781ca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page