Extension to pyhf for correlated uncertainties
Project description
pyhfcorr
Treating correlated uncertainties with pyhf
pyhf is based on the HistFactory statistical model. This is a very general tool for statistical inference of binned data.
One feature that is not included in pyhf is the correct treatment of arbitrarily correlated uncertainties. The current implementation features only fully (de)correlated uncertainties.
The use of this package is to add the option for arbitrarily correlated uncertainties, by a simple pre-processing step of the pyhf model. The mathematical background used is simple singular value decomposition (SVD) (also see below).
To account for correlations between parameters, one simply adds a correlation field to the pyhf model. Here we specify a name, which will be the new modifier name, the correlated variables vars, and the correlation matrix corr:
spec = {
"channels" : ...,
"correlations": [
{
"name": "corr_1_2",
"vars": ["unc1", "unc2"],
"corr": [[1.0, 0.5], [0.5, 1.]],
}
]
}
By pre-processing the model specification, we obtain a new specification, which is now pyhf compatible and has the correlation correctly implemented:
new_spec = pyhfcorr.decorrelate.decorrelate(spec)
Singular value decomposition
We can decompose a correlation matrix $C$ as
$$ C = U S^2 U^H = USSU^H = (US)(US)^H,$$
where $U$ is a unitary transformation matrix, $UU^H=1$ and $S$ is the diagonal matrix of standard deviations, $S=S^H$.
The geometrical interpretation of this is, that by applying the transformation $(US)^{-1}$ to correlated data results in an uncorrelated data-set with unity standard deviation.
The rotation $U^{-1} = U^H$ rotates points to a new coordinate system, where correlations between the dimensions vanish. In this rotated coordinate system, $S^{-1}$ scales the dimensions accordingly.
An illustration for a 2-dimensional random multivariate dataset $x$ with correlation coefficient $\rho=0.8$ is shown here:
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 pyhfcorr-0.1.dev39.tar.gz.
File metadata
- Download URL: pyhfcorr-0.1.dev39.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c8623babaa2ccd80e046ece11a354a1b830f31b43aa13229f02023d6a238552
|
|
| MD5 |
c5eb9ad5961bf418c40063cc70ea6d42
|
|
| BLAKE2b-256 |
6e641d06858fb115a7df49fc43dfd9e543a127286c7492f8bbc06d9b9f8916e7
|
File details
Details for the file pyhfcorr-0.1.dev39-py3-none-any.whl.
File metadata
- Download URL: pyhfcorr-0.1.dev39-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5021652121d0856c32787c4e7c31c313637d9961dac3a3f8cea07771d3956a36
|
|
| MD5 |
7ea936405007a31be4d09bb21f4ed54d
|
|
| BLAKE2b-256 |
e740e3b85aacb60637f213107e317d3d500f34c6b9488d54bb3d708d072399b9
|