Skip to content

Probability ​

P(cond)P(cond) under x's distribution.

Probability(cond, Distributed(x, dist))exact for Equal/Less/LessEqual conditions on x (a chained range too); otherwise stays unevaluated.
Typed signatures
TypePackageApplies
(any, expression<Distributed>) -> realstatisticsalways

Domain: Statistics

Details
  • Equal(x, k): PDF(k)(k) for a discrete distribution, 00 for a continuous one.
  • LessEqual(x, k): CDF(k)(k). Less(x, k): CDF(k)−PDF(k)CDF(k) - PDF(k) for discrete (subtracting P(X=k)P(X{=}k)), just CDF(k)CDF(k) for continuous (where a point has probability 00). A constant on the LEFT (k \[LessEqual] x) is the complement of the opposite strict relation.
  • A chained range, a \[LessEqual] x \[LessEqual] b (and the Less/mixed forms), and And of two simple relations on x: composed from the primitives above by inclusion–exclusion.
  • Greater/GreaterEqual need no separate handling — compute-engine's own canonicalization rewrites x > k to Less(k, x) before this ever sees it.

Examples

Basic #
live ↗
InProbability(x=2,Distributed(x,PoissonDistribution⁡(3)))\mathrm{Probability}(x=2, \mathrm{Distributed}(x, \operatorname{PoissonDistribution}(3)))Out92e3\frac{9}{2e^{3}}
live ↗
InProbability(x=2,Distributed(x,NormalDistribution⁡(0,1)))\mathrm{Probability}(x=2, \mathrm{Distributed}(x, \operatorname{NormalDistribution}(0, 1)))Out00

≈0.9160820579686966\approx 0.9160820579686966, cross-checked against wolframscript's N[CDF[PoissonDistribution[3],5]]

live ↗
InProbability(x≤5,Distributed(x,PoissonDistribution⁡(3)))\mathrm{Probability}(x≤5, \mathrm{Distributed}(x, \operatorname{PoissonDistribution}(3)))Out925e3\frac{92}{5e^{3}}
Scope #

≈0.8662949896008326\approx 0.8662949896008326, cross-checked against wolframscript's N[Probability[1<=x<=5, x \[Distributed] PoissonDistribution[3]]]

live ↗
InProbability(1≤x∧x≤5,Distributed(x,PoissonDistribution⁡(3)))\mathrm{Probability}(1≤x∧x≤5, \mathrm{Distributed}(x, \operatorname{PoissonDistribution}(3)))Out875e3\frac{87}{5e^{3}}

compute-engine rewrites x > 0 to Less(0, x) before this evaluator sees it

live ↗
InN(Probability(x>0,Distributed(x,NormalDistribution⁡(0,1))))N(\mathrm{Probability}(x\gt0, \mathrm{Distributed}(x, \operatorname{NormalDistribution}(0, 1))))Out0.50.5
Applications #

The chance of at least one hit, 1−(1−p)n1-(1-p)^n at p=10−4p=10^{-4}

live ↗
In(()↦Simplify(_1⁡,n>0))(Probability(1≤x,Distributed(x,BinomialDistribution⁡(n,1/10 000))))(()↦\mathrm{Simplify}(\operatorname{\_1}, n\gt0))(\mathrm{Probability}(1≤x, \mathrm{Distributed}(x, \operatorname{BinomialDistribution}(n, 1/10\,000))))Out1−(9 99910 000)n1-(\frac{9\,999}{10\,000})^{n}

P(X=0)=e−0.64P(X=0)=e^{-0.64}, as a number

live ↗
InN(Probability(x=0,Distributed(x,PoissonDistribution⁡(16/25))))N(\mathrm{Probability}(x=0, \mathrm{Distributed}(x, \operatorname{PoissonDistribution}(16/25))))Out0.527 292 424 043 048 557 2440.527\,292\,424\,043\,048\,557\,244

The rate simplifies to 10, and P(N=0)=e−10P(N=0)=e^{-10}

live ↗
InProbability(n=0,Distributed(n,PoissonDistribution⁡(10 000103)))\mathrm{Probability}(n=0, \mathrm{Distributed}(n, \operatorname{PoissonDistribution}(\frac{10\,000}{10^3})))Oute−10e^{-10}
About
Examples8
Checked againstWolfram Language 3 agree

See also: Distributed, Expectation, CDF