# non-normal
Generate a non-normal distributions with given a mean, variance, skewness and kurtosis using
the [Fleishman Method](https://link.springer.com/article/10.1007/BF02293811),
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](https://raw.githubusercontent.com/amanchokshi/non-normal/main/docs/imgs/banner.png)
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,}
```
### References
1. [A method for simulating non-normal distributions](https://link.springer.com/article/10.1007/BF02293811)
2. [Functions for Simulating Data by Using Fleishman’s Transformation](https://support.sas.com/content/dam/SAS/support/en/books/simulating-data-with-sas/65378_Appendix_D_Functions_for_Simulating_Data_by_Using_Fleishmans_Transformation.pdf)
3. [Generation of Non-normal Data – A Study of Fleishman’s Power Method](https://www.diva-portal.org/smash/get/diva2:407995/FULLTEXT01.pd)
4. [Computing the real solutions of Fleishman's equations for simulating non-normal data](https://pubmed.ncbi.nlm.nih.gov/34779511/)
5. [Simulating multivariate nonnormal distributions](https://link.springer.com/article/10.1007/BF02293687)
6. [https://gist.github.com/zeimusu/7432603b85dc6406c6ea](https://gist.github.com/zeimusu/7432603b85dc6406c6ea)
Raw data
{
"_id": null,
"home_page": "https://github.com/<your-username>/hypermodern-python",
"name": "non-normal",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<4.0",
"maintainer_email": "",
"keywords": "non-normal,fleishman,distribution,statistics",
"author": "Aman Chokshi",
"author_email": "achokshi@student.unimelb.edu.au",
"download_url": "https://files.pythonhosted.org/packages/27/5a/1145221143314077c7b1b24f90ec3e31d02654844891ad9b86e920485b8a/non-normal-0.1.2.tar.gz",
"platform": null,
"description": "# non-normal\nGenerate a non-normal distributions with given a mean, variance, skewness and kurtosis using\nthe [Fleishman Method](https://link.springer.com/article/10.1007/BF02293811),\nessentially a cubic transformation on a standard normal [X~N(0, 1)]\n\n$$\nY =a +bX +cX^2 +dX^3\n$$\n\nwhere the coefficients ($a, b, c, d$) are tuned to create a distribution\nwith the desired statistic\n\n![Non-Normal Distribution](https://raw.githubusercontent.com/amanchokshi/non-normal/main/docs/imgs/banner.png)\nFigure 1. A non-normal field generated in the `usage` section below. The title\nshows the input parameters, and the emperically measured statistics of the \ngenerated distribution\n\n### Installation\n\nInstalls cleanly with a single invocation of the standard Python package tool:\n\n```\n$ pip install non-normal\n```\n\n### Usage\n\n```\nfrom non_normal import fleishman\n\n# Input parameters for non-normal field\nmean = 0\nvar = 1\nskew = 1\nekurt = 2\nsize = 2**20\n\n# Create an instance of the Fleishman class\nff = fleishman.Fleishman(mean=mean, var=var, skew=skew, ekurt=ekurt, size=size)\n\n# Generate the field\nff.gen_field()\nnon_normal_data = ff.field\n\n# Measure the stats of the generated samples\nff.field_stats\n\n>>> {'mean': 0.000203128504124, \n 'var': 1.001352686678266, \n 'skew': 1.005612915524984, \n 'ekurt': 2.052527629375554,}\n```\n\n### References\n\n1. [A method for simulating non-normal distributions](https://link.springer.com/article/10.1007/BF02293811)\n2. [Functions for Simulating Data by Using Fleishman\u2019s Transformation](https://support.sas.com/content/dam/SAS/support/en/books/simulating-data-with-sas/65378_Appendix_D_Functions_for_Simulating_Data_by_Using_Fleishmans_Transformation.pdf)\n3. [Generation of Non-normal Data \u2013 A Study of Fleishman\u2019s Power Method](https://www.diva-portal.org/smash/get/diva2:407995/FULLTEXT01.pd)\n4. [Computing the real solutions of Fleishman's equations for simulating non-normal data](https://pubmed.ncbi.nlm.nih.gov/34779511/)\n5. [Simulating multivariate nonnormal distributions](https://link.springer.com/article/10.1007/BF02293687)\n6. [https://gist.github.com/zeimusu/7432603b85dc6406c6ea](https://gist.github.com/zeimusu/7432603b85dc6406c6ea)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Generate non-normal distributions with known mean, variance, skewness and kurtosis",
"version": "0.1.2",
"project_urls": {
"Homepage": "https://github.com/<your-username>/hypermodern-python",
"Repository": "https://github.com/<your-username>/hypermodern-python"
},
"split_keywords": [
"non-normal",
"fleishman",
"distribution",
"statistics"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cea73a583059688a12a5f011238c2cb8fa8400498559681c7a13d37ae91a5eec",
"md5": "f828ca617876f5ec13337fbb9d052cbe",
"sha256": "30820a766d3e24cbf19b73337e77aa79d7f997dfb581c3a1930465a2f8598dfb"
},
"downloads": -1,
"filename": "non_normal-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f828ca617876f5ec13337fbb9d052cbe",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 5637,
"upload_time": "2023-06-26T01:48:47",
"upload_time_iso_8601": "2023-06-26T01:48:47.386224Z",
"url": "https://files.pythonhosted.org/packages/ce/a7/3a583059688a12a5f011238c2cb8fa8400498559681c7a13d37ae91a5eec/non_normal-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "275a1145221143314077c7b1b24f90ec3e31d02654844891ad9b86e920485b8a",
"md5": "7d7788ad442826ce9bd02eb254486008",
"sha256": "388a40bfb58a57a0bf9dbb244963e8f655dc22f089d92e75e8dd57cd9d643ec8"
},
"downloads": -1,
"filename": "non-normal-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "7d7788ad442826ce9bd02eb254486008",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 5424,
"upload_time": "2023-06-26T01:48:45",
"upload_time_iso_8601": "2023-06-26T01:48:45.994225Z",
"url": "https://files.pythonhosted.org/packages/27/5a/1145221143314077c7b1b24f90ec3e31d02654844891ad9b86e920485b8a/non-normal-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-26 01:48:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "<your-username>",
"github_project": "hypermodern-python",
"github_not_found": true,
"lcname": "non-normal"
}