Skip to main content

Multivariate Laplace Distribution Sampler

Project description

Multivariate Laplace Distribution

A sampler package from a Multivariate Laplace distrbrution.

Background

I've been exploring Quantitative Finance for awhile now, and one frustrating point is the lack of a good sampler for a Multivariate Laplace distribution. As such I re-purposed a multivariate normal, normal, and Laplace distribution to fill the role of a multivariate Laplace. This isn't a fully implemented scipy-like class, similar to my PertDist package, but just enough for me to spin up a custom MCMC routine and do some proper financial modeling.

Installation

This package is on PyPi, and can be installed using pip install mv-laplace

Usage

Unlike the scipy implementations this is based on, this distribution class provides sampling abilities only and no distributional parameters. The package is pretty straightforward to use:

from mv_laplace import MvLaplaceSampler

sampler = MvLaplaceSampler(loc, cov)
samples = sampler.sample(sample_size)

The input should be a pair of arrays, the first of which containing the location values (the means) in a vector of length M, and the second containing the covariance matrix in a MxM matrix. The return will be a NxM matrix, with N being the sample_size input on the sampler. I used Wikipedia for basic reference on terminology.

Disclaimer

I provide no guarentees that this package fits proper statistical robustness of how a multivariate Laplace is supposed to work, just that it seems to work for the use case I have identified. Use at your own risk.

Roadmap

  • Figure out how to calculate summary information, and refactor API to a scipi-like interface
  • Add a Multivariate Asymmetric Laplace distribution class

Version History

License

This project uses the GNU General Public License.

Short version: Have fun and use it for whatever, just make sure to attribute me for it (-:

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

mv-laplace-0.1.1.tar.gz (14.9 kB view hashes)

Uploaded Source

Built Distribution

mv_laplace-0.1.1-py3-none-any.whl (15.2 kB view hashes)

Uploaded Python 3

Supported by

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