From bea4e13cd315e895ac06c1d859cbf6cf639f7b5b Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Sun, 12 Jun 2022 21:33:40 -0700 Subject: [PATCH] Minor cleanup on distributions --- packages/website/docs/Api/DistGeneric.mdx | 89 +++++++++++++---------- 1 file changed, 52 insertions(+), 37 deletions(-) diff --git a/packages/website/docs/Api/DistGeneric.mdx b/packages/website/docs/Api/DistGeneric.mdx index 4e91543c..93833f3e 100644 --- a/packages/website/docs/Api/DistGeneric.mdx +++ b/packages/website/docs/Api/DistGeneric.mdx @@ -19,7 +19,7 @@ These are functions for creating primative distributions. Many of these could op See a longer tutorial on creating distributions [here](/docs/Guides/DistributionCreation). -### Normal +### normal **Definitions** @@ -39,7 +39,7 @@ normal(5 to 10, normal(3, 2)) normal({ mean: uniform(5, 9), stdev: 3 }) ``` -### Lognormal +### lognormal **Definitions** @@ -57,7 +57,7 @@ lognormal({ p5: 4, p95: 10 }) lognormal({ mean: 5, stdev: 2 }) ``` -### Uniform +### uniform **Definitions** @@ -71,7 +71,7 @@ uniform: (distribution|number, distribution|number) => distribution uniform(10, 12) ``` -### Beta +### beta **Definitions** @@ -85,7 +85,7 @@ beta: (distribution|number, distribution|number) => distribution beta(20, 25) ``` -### Cauchy +### cauchy **Definitions** @@ -99,7 +99,7 @@ cauchy: (distribution|number, distribution|number) => distribution cauchy(5, 1) ``` -### Gamma +### gamma **Definitions** @@ -127,13 +127,55 @@ logistic: (distribution|number, distribution|number) => distribution gamma(5, 1) ``` -### To (Distribution) +### exponential + +**Definitions** + +```javascript +exponential: (distribution|number) => distribution +``` + +**Examples** + +```javascript +exponential(2) +``` + +### bernoulli + +**Definitions** + +```javascript +bernoulli: (distribution|number) => distribution +``` + +**Examples** + +```javascript +bernoulli(0.5) +``` + +### triangular + +**Definitions** + +```javascript +triangular: (number, number, number) => distribution +``` + +**Examples** + +```javascript +triangular(5, 10, 20) +``` + +### To / credibleIntervalToDistribution The `to` function is an easy way to generate simple distributions using predicted _5th_ and _95th_ percentiles. If both values are above zero, a `lognormal` distribution is used. If not, a `normal` distribution is used. -**Definitions** +``To`` is an alias for ``credibleIntervalToDistribution``. However, because of its frequent use, it is recommended to use the shorter name. ```javascript to: (distribution|number, distribution|number) => distribution @@ -148,35 +190,6 @@ to(5,10) -5 to 5 ``` -### Exponential - -**Definitions** - -```javascript -exponential: (distribution|number) => distribution -``` - -**Examples** - -```javascript -exponential(2) -``` - -### Bernoulli - -**Definitions** - -```javascript -bernoulli: (distribution|number) => distribution -``` - -**Examples** - -```javascript -bernoulli(0.5) -``` - -## Functions ### mixture @@ -193,6 +206,8 @@ mx(normal(5, 1), normal(10, 1), [0.3, 0.7]) mx([normal(5, 1), normal(10, 1)], [0.3, 0.7]) ``` +## Functions + ### sample One random sample from the distribution