truncnorm


Nametruncnorm JSON
Version 0.0.2 PyPI version JSON
download
home_page
SummaryMoments for doubly truncated multivariate normal distributions
upload_time2024-02-28 15:25:26
maintainer
docs_urlNone
authorJaakko Luttinen
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # TruncNorm

Arbitrary order moments for truncated multivariate normal distributions.

## Introduction

Given

```
X ~ N(m, C), a <= X <= b
```

with mean vector `m`, covariance matrix `C`, lower limit vector `a` and upper
limit vector `b`,

``` python
import truncnorm
truncnorm.moments(m, C, a, b, 4)
```

returns all the following moments of total order less or equal to 4 as a list:

```
[
  P(a<=X<=b),           (scalar)
  E[X_i],               (N vector)
  E[X_i*X_j],           (NxN matrix)
  E[X_i*X_j*X_k],       (NxNxN array)
  E[X_i*X_j*X_k*X_l],   (NxNxNxN array)
]
```

for all `i`, `j`, `k` and `l`. Note that the first element in the list is a bit
of a special case. That's because `E[1]` is trivially `1` so giving the
normalisation constant instead is much more useful.

## TODO

- Double truncation
- Numerical stability could probably be increased by using logarithic scale in
  critical places of the algorithm
- Sampling (see Gessner et al below)
- Folded distribution
- Optimize recurrent integrals by using vector and index-mapping representation
  instead of arrays. Using arrays makes computations efficient and simple, but
  same elements are computed multiple times because of symmetry in the moments.

## References

- "On Moments of Folded and Truncated Multivariate Normal Distributions" by
Raymond Kan & Cesare Robotti, 2016

- "Integrals over Gaussians under Linear Domain Constraints" by Alexandra Gessner
& Oindrila Kanjilal & Philipp Hennig, 2020

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "truncnorm",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Jaakko Luttinen",
    "author_email": "jaakko.luttinen@iki.fi",
    "download_url": "https://files.pythonhosted.org/packages/36/8f/fcce97da63b7b00d35812362c3fae912bc36526444f4b9cb21d36de44a6f/truncnorm-0.0.2.tar.gz",
    "platform": null,
    "description": "# TruncNorm\n\nArbitrary order moments for truncated multivariate normal distributions.\n\n## Introduction\n\nGiven\n\n```\nX ~ N(m, C), a <= X <= b\n```\n\nwith mean vector `m`, covariance matrix `C`, lower limit vector `a` and upper\nlimit vector `b`,\n\n``` python\nimport truncnorm\ntruncnorm.moments(m, C, a, b, 4)\n```\n\nreturns all the following moments of total order less or equal to 4 as a list:\n\n```\n[\n  P(a<=X<=b),           (scalar)\n  E[X_i],               (N vector)\n  E[X_i*X_j],           (NxN matrix)\n  E[X_i*X_j*X_k],       (NxNxN array)\n  E[X_i*X_j*X_k*X_l],   (NxNxNxN array)\n]\n```\n\nfor all `i`, `j`, `k` and `l`. Note that the first element in the list is a bit\nof a special case. That's because `E[1]` is trivially `1` so giving the\nnormalisation constant instead is much more useful.\n\n## TODO\n\n- Double truncation\n- Numerical stability could probably be increased by using logarithic scale in\n  critical places of the algorithm\n- Sampling (see Gessner et al below)\n- Folded distribution\n- Optimize recurrent integrals by using vector and index-mapping representation\n  instead of arrays. Using arrays makes computations efficient and simple, but\n  same elements are computed multiple times because of symmetry in the moments.\n\n## References\n\n- \"On Moments of Folded and Truncated Multivariate Normal Distributions\" by\nRaymond Kan & Cesare Robotti, 2016\n\n- \"Integrals over Gaussians under Linear Domain Constraints\" by Alexandra Gessner\n& Oindrila Kanjilal & Philipp Hennig, 2020\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Moments for doubly truncated multivariate normal distributions",
    "version": "0.0.2",
    "project_urls": {
        "Bug reports": "https://github.com/jluttine/truncnorm/issues",
        "Contributing": "https://github.com/jluttine/truncnorm/pulls",
        "Download": "https://pypi.org/project/truncnorm/",
        "Homepage": "https://github.com/jluttine/truncnorm"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "368ffcce97da63b7b00d35812362c3fae912bc36526444f4b9cb21d36de44a6f",
                "md5": "a64e1ce75ecbc0d33804af779e2424c6",
                "sha256": "0fab29ccb2df76651a136f89f80e956bb099cde6fda6b26bde76f948d01698e8"
            },
            "downloads": -1,
            "filename": "truncnorm-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "a64e1ce75ecbc0d33804af779e2424c6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7158,
            "upload_time": "2024-02-28T15:25:26",
            "upload_time_iso_8601": "2024-02-28T15:25:26.170700Z",
            "url": "https://files.pythonhosted.org/packages/36/8f/fcce97da63b7b00d35812362c3fae912bc36526444f4b9cb21d36de44a6f/truncnorm-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-28 15:25:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jluttine",
    "github_project": "truncnorm",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "truncnorm"
}
        
Elapsed time: 0.28819s