Skip to main content

Generate non-normal distributions with known mean, variance, skewness and kurtosis

Project description

non-normal

Generate a non-normal distributions with given a mean, variance, skewness and kurtosis using the Fleishman Method, essentially a cubic transformation on a standard normal [X~N(0, 1)]

$$ Y =a +bX +cX^2 +dX^3 $$

where the coefficients ($a, b, c, d$) are tuned to create a distribution with the desired statistic

Non-Normal Distribution Figure 1. A non-normal field generated in the usage section below. The title shows the input parameters, and the emperically measured statistics of the generated distribution

Installation

Installs cleanly with a single invocation of the standard Python package tool:

$ pip install non-normal

Usage

from non_normal import fleishman

# Input parameters for non-normal field
mean = 0
var = 1
skew = 1
ekurt = 2
size = 2**20

# Create an instance of the Fleishman class
ff = fleishman.Fleishman(mean=mean, var=var, skew=skew, ekurt=ekurt, size=size)

# Generate the field
ff.gen_field()
non_normal_data = ff.field

# Measure the stats of the generated samples
ff.field_stats

>>> {'mean':    0.000203128504124, 
     'var':     1.001352686678266, 
     'skew':    1.005612915524984, 
     'ekurt':   2.052527629375554,}

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

non-normal-0.1.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

non_normal-0.1.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file non-normal-0.1.1.tar.gz.

File metadata

  • Download URL: non-normal-0.1.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.3 Darwin/22.4.0

File hashes

Hashes for non-normal-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a8a4822d10a98da392db4a25b37ec3da27579a1c696f98eff3594a83eb654fc3
MD5 b96df3fa0364a3b5fe6235a1d9b1b0f2
BLAKE2b-256 f46a8dff84aa8c30f76afcf200b95de022934e173018dc6050625aae025f43cb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: non_normal-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.3 Darwin/22.4.0

File hashes

Hashes for non_normal-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d89c0d1619cf7e47158ec2cf71b09800c03e86ad0dafc8c2e14ce3f4be6afa33
MD5 8e08ff182f98f03f45e5bec6504f92d7
BLAKE2b-256 3ba7cec865381dba959a5e56b63fe815e4842d5f42e70c335b9372df99c96ece

See more details on using hashes here.

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