Conditioned
conditioned on — meaningful only as Probability's or Expectation's first argument.
Probability(Conditioned(pred, cond), Distributed(x, dist))P(pred | cond) = P(pred, cond) / P(cond), for the discrete and closed-form-CDF cases Probability itself handles; otherwise stays unevaluated.Expectation(Conditioned(f, cond), Distributed(x, dist))E[f | cond]: exact for cond pinning x to a point (any distribution), or cond bounding x to a finite interval on a discrete distribution; otherwise stays unevaluated.Typed signatures
| Type | Package | Applies |
|---|---|---|
(any, any) -> expression<Conditioned> | statistics | always |
Details
Conditionedis a bare inert constructor (like Distributed) — it does nothing on its own; both evaluations above happen insideProbability/Expectation, triggered by seeingConditionedas their first argument.Probability's case is built entirely by calling back intoProbabilityitself: the numerator isProbability(And(pred, cond), binding), the denominatorProbability(cond, binding)— so it inherits every discrete-PDF and closed-form-CDF case any wave of this package has added, with no new distribution-shape knowledge needed here. One extra case past the plainAndmachinery:pred = Equal(x, k)is evaluated directly asPDF(k)/P(cond)(or0, ifcondfails atk), sinceProbability's ownAndcase only recognizes a conjunction of twoLess/LessEqualrelations, notEqualcombined with anything.Expectation's case:cond = Equal(x, k)collapsesfto its value atk, for any distribution. A finite interval condition on a DISCRETE distribution sums exactly over the (necessarily finite) support the interval implies. A continuous distribution with an interval condition — which the exact machinery for a truncated continuous mean already exists for, in TruncatedDistribution — is NOT composed through here; out of scope for this batch, so it stays unevaluated.- Neither case falls back to numeric approximation — see NProbability/NExpectation for that.
Examples
Basic #
for — exact, the factor cancels. Cross-checked against wolframscript's N[Probability[x == 2 \[Conditioned] x <= 5, x \[Distributed] PoissonDistribution[3]], 10].
for — an exact finite sum over . Cross-checked against wolframscript's N[Expectation[x \[Conditioned] x <= 3, x \[Distributed] PoissonDistribution[3]], 10].
Scope #
for — both pred and cond are single LessEqual relations, the shape Probability's own And case composes. Cross-checked against wolframscript's N[Probability[x <= 3 \[Conditioned] x >= 1, x \[Distributed] PoissonDistribution[3]], 10].
for standard normal — the closed-form-CDF case, not just discrete PDFs. Cross-checked against wolframscript's N[Probability[x <= 0 \[Conditioned] x >= -1, x \[Distributed] NormalDistribution[0,1]], 10].
Possible issues #
A continuous distribution with an interval condition is out of scope here (see the truncated-mean note above) and stays unevaluated, even though Probability's analogous case (previous example) works.
About
| Examples | 6 |
|---|
See also: Probability, Expectation, NProbability, NExpectation, TruncatedDistribution