squiggle/packages/website/docs/Api/DistributionCreation.md

3.2 KiB

sidebar_position title
1 Distribution Creation

Normal Distribution

Definitions

normal(frValueDistOrNumber, frValueDistOrNumber)
normal(dict<{p5: frValueDistOrNumber, p95: frValueDistOrNumber}>)
normal(dict<{mean: frValueDistOrNumber, stdev: frValueDistOrNumber}>)

Examples

normal(5,1)
normal({p5: 4, p95: 10})
normal({mean: 5, stdev: 2})

Lognormal Distribution

Definitions

lognormal(frValueDistOrNumber, frValueDistOrNumber)
lognormal(dict<{p5: frValueDistOrNumber, p95: frValueDistOrNumber}>)
lognormal(dict<{mean: frValueDistOrNumber, stdev: frValueDistOrNumber}>)

Examples

lognormal(0.5, 0.8)
lognormal({p5: 4, p95: 10})
lognormal({mean: 5, stdev: 2})

Uniform Distribution

Definitions

uniform(frValueDistOrNumber, frValueDistOrNumber)

Examples

uniform(10, 12)

Beta Distribution

Definitions

beta(frValueDistOrNumber, frValueDistOrNumber)

Examples

beta(20, 25)

Cauchy Distribution

Definitions

cauchy(frValueDistOrNumber, frValueDistOrNumber)

Examples

cauchy(5, 1)

Gamma Distribution

Definitions

gamma(frValueDistOrNumber, frValueDistOrNumber)

Examples

gamma(5, 1)

Logistic Distribution

Definitions

logistic(frValueDistOrNumber, frValueDistOrNumber)

Examples

gamma(5, 1)

To (Distribution)

Definitions

to(frValueDistOrNumber, frValueDistOrNumber)
credibleIntervalToDistribution(frValueDistOrNumber, frValueDistOrNumber)

Examples

5 to 10
to(5,10)
-5 to 5

Exponential

Definitions

exponential(frValueDistOrNumber)

Examples

exponential(2)

Bernoulli

Definitions

bernoulli(frValueDistOrNumber)

Examples

bernoulli(0.5)

toContinuousPointSet

Converts a set of points to a continuous distribution

Definitions

toContinuousPointSet(array<dict<{x: numeric, y: numeric}>>)

Examples

toContinuousPointSet([
  {x: 0, y: 0.1},
  {x: 1, y: 0.2},
  {x: 2, y: 0.15},
  {x:3, y: 0.1}
])

toDiscretePointSet

Converts a set of points to a discrete distribution

Definitions

toDiscretePointSet(array<dict<{x: numeric, y: numeric}>>)

Examples

toDiscretePointSet([
  {x: 0, y: 0.1},
  {x: 1, y: 0.2},
  {x: 2, y: 0.15},
  {x:3, y: 0.1}
])

Declaration (Continuous Function)

Adds metadata to a function of the input ranges. Works now for numeric and date inputs. This is useful when making predictions. It allows you to limit the domain that your prediction will be used and scored within.

Definitions

declareFn(dict<{fn: lambda, inputs: array<dict<{min: number, max: number}>>}>)

Examples

declareFn({
  fn: {|a,b| a },
  inputs: [
    {min: 0, max: 100},
    {min: 30, max: 50}
  ]
})