Skip to content

TruncatedDistribution ​

distdist restricted to [a,b][a,b] (continuous) or (a,b](a,b] (discrete), renormalized.

TruncatedDistribution({a, b}, dist)restricts dist to [a, b] (continuous) or (a, b] (discrete), renormalized.
Typed signatures
TypePackageApplies
(list<real>, distribution) -> distributionstatisticsalways

Domain: Statistics

Details
  • Z=CDF(dist,b)−CDF(dist,a)Z = CDF(dist,b) - CDF(dist,a); PDF(x)=PDF(dist,x)/ZPDF(x) = PDF(dist,x)/Z inside the support, 00 outside.
  • A continuous base's support is the CLOSED interval [a,b][a,b]; a DISCRETE base's support is the right-HALF-OPEN interval (a,b](a,b] — Wolfram's own convention (e.g. TruncatedDistribution[{2,5}, PoissonDistribution[3]] has support {3,4,5}\{3,4,5\}, not {2,...,5}\{2,...,5\}). Both share the same normalizer ZZ, since CDF(x)=P(X≤x)CDF(x) = P(X \le x) either way.
  • CDF(x)=(CDF(dist,x)−CDF(dist,a))/ZCDF(x) = (CDF(dist,x) - CDF(dist,a))/Z for xx in range, clamped to 00 below and 11 above.
  • MeanMean is exact only where the base has a closed-form partial expectation this package knows: UniformDistribution (trivially — the truncated uniform IS Uniform(a,b)Uniform(a,b)), NormalDistribution (the standard truncated-normal-mean identity), ExponentialDistribution (compute-engine native, via the memoryless shift identity). Any other base's MeanMean stays unevaluated.
  • Variance is not implemented for this head (out of scope for this batch) — stays unevaluated.

Examples

Basic #
live ↗
InPDF⁡(TruncatedDistribution([14,34],UniformDistribution⁡(0,1)),12)\operatorname{PDF}(\mathrm{TruncatedDistribution}(\bigl\lbrack\frac{1}{4}, \frac{3}{4}\bigr\rbrack, \operatorname{UniformDistribution}(0, 1)), \frac{1}{2})Out22
live ↗
InPDF⁡(TruncatedDistribution([14,34],UniformDistribution⁡(0,1)),110)\operatorname{PDF}(\mathrm{TruncatedDistribution}(\bigl\lbrack\frac{1}{4}, \frac{3}{4}\bigr\rbrack, \operatorname{UniformDistribution}(0, 1)), \frac{1}{10})Out00
live ↗
Inmean(TruncatedDistribution([14,34],UniformDistribution⁡(0,1)))\mathrm{mean}(\mathrm{TruncatedDistribution}(\bigl\lbrack\frac{1}{4}, \frac{3}{4}\bigr\rbrack, \operatorname{UniformDistribution}(0, 1)))Out12\frac{1}{2}
live ↗
Inmean(TruncatedDistribution([−1,1],NormalDistribution⁡(0,1)))\mathrm{mean}(\mathrm{TruncatedDistribution}(\bigl\lbrack-1, 1\bigr\rbrack, \operatorname{NormalDistribution}(0, 1)))Out00
live ↗
InPDF⁡(TruncatedDistribution([1,4],PoissonDistribution⁡(2)),1)\operatorname{PDF}(\mathrm{TruncatedDistribution}(\bigl\lbrack1, 4\bigr\rbrack, \operatorname{PoissonDistribution}(2)), 1)Out00
About
Examples5

See also: MixtureDistribution, PDF, CDF, Mean