A probability distribution: a concrete core._Value, bindable in an Environment and round-trippable through :save.
Construction routes through _Distribution.of, which validates the parameters, so every instance that exists is a well-formed distribution.
Value parameters
- kind
-
the family
- params
-
the family's parameters, in the order the grammar takes them
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait _Valuetrait _Expressionclass Objecttrait Matchableclass AnyShow all
Members list
Value members
Concrete methods
The cumulative distribution function P(X ≤ x).
The cumulative distribution function P(X ≤ x).
Every one of these is a closed form built on the special-function kernels rather than a numeric integral of pdf: the normal is erfc, the gamma-family tails are the regularised incomplete gamma, and the binomial tail is the regularised incomplete beta. Numeric integration is available through _DefIntegral for anything added later that has no closed form, but using it here would be slower and less accurate for no reason.
Value parameters
- x
-
the point
Attributes
- Returns
-
P(X ≤ x)in[0, 1], orNonewhere undefined
Sub-expressions subject to recursive structural traversal. Binder positions (e.g. the differentiation variable) are excluded.
Sub-expressions subject to recursive structural traversal. Binder positions (e.g. the differentiation variable) are excluded.
Attributes
- Definition Classes
Renders at precision decimal places, as the grammar call that rebuilds it.
Renders at precision decimal places, as the grammar call that rebuilds it.
Value parameters
- precision
-
decimal places for the parameters
Attributes
Returns Right(this) — a distribution is already fully reduced.
Returns Right(this) — a distribution is already fully reduced.
Attributes
- Definition Classes
Whether this family is supported on the integers rather than on an interval.
Whether this family is supported on the integers rather than on an interval.
Decides which of pdf and pmf is meaningful, and makes prob sum rather than subtract cdfs at the lower endpoint — for a discrete family P(lo ≤ X ≤ hi) has to include lo itself.
Attributes
The mean E[X].
The mean E[X].
Attributes
- Returns
-
the mean, or
Noneif it does not exist
The density at x (continuous families) or the mass at x (discrete ones).
The density at x (continuous families) or the mass at x (discrete ones).
Value parameters
- x
-
the point
Attributes
- Returns
-
the density or mass, or
Nonewhere the family is undefined
P(lo ≤ X ≤ hi).
P(lo ≤ X ≤ hi).
For a discrete family the lower endpoint is included, which cdf(hi) − cdf(lo) would silently exclude — P(1 ≤ X ≤ 3) on a binomial must count X = 1.
Value parameters
- hi
-
the upper bound
- lo
-
the lower bound
Attributes
- Returns
-
the probability, or
Nonewhere undefined
Reconstructs the same node shape with replacement sub-expressions.
Reconstructs the same node shape with replacement sub-expressions.
Value parameters
- newChildren
-
replacements in the same order and count as
children
Attributes
- Definition Classes
Renders as the grammar call that rebuilds it, so a bound distribution round-trips.
Renders as the grammar call that rebuilds it, so a bound distribution round-trips.
Attributes
- Definition Classes
-
Any
The variance Var(X).
The variance Var(X).
Attributes
- Returns
-
the variance, or
Noneif it does not exist
Inherited methods
Attributes
- Inherited from:
- Product
Attributes
- Inherited from:
- Product
Inherited fields
Cached set of free variable names; O(1) after the first access.
Cached set of free variable names; O(1) after the first access.
Attributes
- Inherited from:
- _Expression