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.5.tar.gz (5.8 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.5-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: christoffersen_lib-0.1.5.tar.gz
  • Upload date:
  • Size: 5.8 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.5.tar.gz
Algorithm Hash digest
SHA256 47a0d446225a63845fdbf4d9928e6819cacf683addae0974d60d7fc4ff1e3812
MD5 bfe05e7352a01b81600b5265b41c8cb4
BLAKE2b-256 858b0edeef545ce82e3a95340bfdce75bc033e6636a7d1b0cb37db7c0a4a1055

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for christoffersen_lib-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 114cb28431be0400a71790800f1772e41c7565a5564da443575b58e9367eb3ae
MD5 3e1c7d8904e6a3276bbf3613a7758879
BLAKE2b-256 9d6f40417a38f7a08fdad7995d4b989e30e9c884b8c97a4c613ef3aca2560f01

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