diff --git a/packages/website/docs/Features/Distributions.mdx b/packages/website/docs/Features/Distributions.mdx index 0331ece1..5f6a85a5 100644 --- a/packages/website/docs/Features/Distributions.mdx +++ b/packages/website/docs/Features/Distributions.mdx @@ -1,5 +1,5 @@ --- -title: "Creating Distributions" +title: "Distribution Creation" sidebar_position: 8 --- @@ -13,8 +13,8 @@ import TabItem from "@theme/TabItem"; ## To -`(5thPercentile: float) to (95thPercentile: float)` -`to(5thPercentile: float, 95thPercentile: float)` +`(5thPercentile: number) to (95thPercentile: number)` +`to(5thPercentile: number, 95thPercentile: number)` The `to` function is an easy way to generate simple distributions using predicted _5th_ and _95th_ percentiles. @@ -44,8 +44,8 @@ If both values are above zero, a `lognormal` distribution is used. If not, a `no ### Arguments -- `5thPercentile`: Float -- `95thPercentile`: Float, greater than `5thPercentile` +- `5thPercentile`: number +- `95thPercentile`: number, greater than `5thPercentile`

@@ -68,8 +68,8 @@ If both values are above zero, a `lognormal` distribution is used. If not, a `no ## Mixture -`mixture(...distributions: Distribution[], weights?: float[])` -`mx(...distributions: Distribution[], weights?: float[])` +`mixture(...distributions: Distribution[], weights?: number[])` +`mx(...distributions: Distribution[], weights?: number[])` The `mixture` mixes combines multiple distributions to create a mixture. You can optionally pass in a list of proportional weights. @@ -87,8 +87,8 @@ The `mixture` mixes combines multiple distributions to create a mixture. You can ### Arguments -- `distributions`: A set of distributions or floats, each passed as a paramater. Floats will be converted into Delta distributions. -- `weights`: An optional array of floats, each representing the weight of its corresponding distribution. The weights will be re-scaled to add to `1.0`. If a weights array is provided, it must be the same length as the distribution paramaters. +- `distributions`: A set of distributions or numbers, each passed as a paramater. Numbers will be converted into Delta distributions. +- `weights`: An optional array of numbers, each representing the weight of its corresponding distribution. The weights will be re-scaled to add to `1.0`. If a weights array is provided, it must be the same length as the distribution paramaters. ### Aliases @@ -100,7 +100,7 @@ The `mixture` mixes combines multiple distributions to create a mixture. You can

🕐 Zero or Continuous

One common reason to have mixtures of continous and discrete distributions is to handle the special case of 0. - Say I want to model the time I will spend on some upcoming assignment. I think I have an 80% chance of doing it. + Say I want to model the time I will spend on some upcoming project. I think I have an 80% chance of doing it.

@@ -120,10 +120,6 @@ mx(hours_the_project_will_take, 0, [chance_of_doing_anything, 1 - chance_of_doin "just-in-case distribution". This latter distribution would have very low weight, but would be very wide, just in case they were dramatically off for some weird reason.

-

- One common reason to have mixtures of continous and discrete distributions is to handle the special case of 0. - Say I want to model the time I will spend on some upcoming assignment. I think I have an 80% chance of doing it. -

@@ -149,29 +145,28 @@ Creates a [normal distribution](https://en.wikipedia.org/wiki/Normal_distributio ### Arguments -- `mean`: Float -- `standard deviation`: Float greater than zero +- `mean`: Number +- `standard deviation`: Number greater than zero [Wikipedia](https://en.wikipedia.org/wiki/Normal_distribution) ## Log-normal -`lognormal(mu: float, sigma: float)` +`lognormal(mu: number, sigma: number)` Creates a [log-normal distribution](https://en.wikipedia.org/wiki/Log-normal_distribution) with the given mu and sigma. +`Mu` and `sigma` can be difficult to directly reason about. Because of this complexity, we recommend typically using the to syntax instead of estimating `mu` and `sigma` directly. + ### Arguments -- `mu`: Float -- `sigma`: Float greater than zero +- `mu`: Number +- `sigma`: Number greater than zero [Wikipedia](https://en.wikipedia.org/wiki/Log-normal_distribution) -### Argument Alternatives -`Mu` and `sigma` can be difficult to directly reason about. Because of this complexity, we recommend typically using the to syntax. -
❓ Understanding mu and sigma

@@ -187,15 +182,15 @@ logOfLognormal = log(lognormal(normalMean, normalStdDev)) ## Uniform -`uniform(low:float, high:float)` +`uniform(low:number, high:number)` Creates a [uniform distribution](https://en.wikipedia.org/wiki/Uniform_distribution_(continuous)) with the given low and high values. ### Arguments -- `low`: Float -- `high`: Float greater than `low` +- `low`: Number +- `high`: Number greater than `low`

@@ -208,7 +203,7 @@ Creates a [uniform distribution](https://en.wikipedia.org/wiki/Uniform_distribut ## Beta -``beta(alpha:float, beta:float)`` +``beta(alpha:number, beta:number)`` Creates a [beta distribution](https://en.wikipedia.org/wiki/Beta_distribution) with the given `alpha` and `beta` values. For a good summary of the beta distribution, see [this explanation](https://stats.stackexchange.com/a/47782) on Stack Overflow. @@ -232,8 +227,8 @@ Creates a [beta distribution](https://en.wikipedia.org/wiki/Beta_distribution) w ### Arguments -- `alpha`: Float greater than zero -- `beta`: Float greater than zero +- `alpha`: Number greater than zero +- `beta`: Number greater than zero

@@ -260,39 +255,37 @@ Creates a [beta distribution](https://en.wikipedia.org/wiki/Beta_distribution) w ## Exponential -``exponential(rate:float)`` +``exponential(rate:number)`` Creates an [exponential distribution](https://en.wikipedia.org/wiki/Exponential_distribution) with the given rate. ### Arguments -- `rate`: Float greater than zero +- `rate`: Number greater than zero ## Triangular distribution -``triangular(low:float, mode:float, high:float)`` +``triangular(low:number, mode:number, high:number)`` Creates a [triangular distribution](https://en.wikipedia.org/wiki/Triangular_distribution) with the given low, mode, and high values. #### Validity ### Arguments -- `low`: Float -- `mode`: Float greater than `low` -- `high`: Float greater than `mode` +- `low`: Number +- `mode`: Number greater than `low` +- `high`: Number greater than `mode` ## FromSamples +``fromSamples(samples:number[])`` + Creates a sample set distribution using an array of samples. -#### Validity - -For `fromSamples(xs)`, - -- `xs.length > 5` -- Strictly every element of `xs` must be a number. +### Arguments +- `samples`: An array of at least 5 numbers. \ No newline at end of file