Statistics
Distribution
create new distribution
Calling Sequence
Parameters
Description
Examples
References
Compatibility
Distribution(D)
Distribution(T1, T2, .., Tn)
D
-
ProbabilityDistribution; built-in probability distribution
Ti
Equation; function or quantity of the new distribution, including PDF, CDF, mean, moment, variance, and others
The Distribution command creates a new distribution with the specified distribution, functions, or quantities.
The first parameter can be one of the supported distributions or a distribution function or quantity.
A distribution can be defined by the following functions and quantities. The other functions and quantities are calculated if possible. If not specified otherwise, the default value for all of these functions and quantities is FAIL, indicating that this quantity needs to be computed from others.
CDF - operator
Operator mapping a value t to the CDF of this distribution at t.
CDFNumeric - appliable
Procedure for efficiently computing a floating-point approximation to the CDF.
CentralMoment - operator
Operator mapping a positive integer n to the nth CentralMoment of this distribution.
CFNumeric - appliable
Procedure for efficiently computing a floating-point approximation to the CharacteristicFunction.
CGF - operator
Operator mapping a value t to the CGF of this distribution at t.
CGFNumeric - appliable
Procedure for efficiently computing a floating-point approximation to the CGF.
CharacteristicFunction - operator
Operator mapping a value t to the CharacteristicFunction of this distribution at t.
Conditions - list(boolean)
List of conditions on parameters occurring in the other defining equations for this distribution. The conditions need to be satisfied for the distribution to be valid. If the conditions are at any point known not to be satisfied, an error is raised; otherwise, the conditions are implicitly assumed to be satisfied. For this quantity, the default value is the empty list, []; you cannot specify FAIL.
If infolevel for Statistics is set to at least 2, the implicit assumptions are printed when they are made.
Cumulant - operator
Operator mapping a positive integer n to the nth Cumulant of this distribution.
DiscreteValueMap - operator
See the DiscreteValueMap help page.
HazardRate - operator
Operator mapping a value t to the HazardRate of this distribution at t.
HodgesLehmann - algebraic
Expression giving the Hodges-Lehmann estimator of this distribution.
InverseSurvivalFunction - operator
Operator mapping a value t to the InverseSurvivalFunction of this distribution at t.
ISFNumeric - appliable
Procedure for efficiently computing a floating-point approximation to the InverseSurvivalFunction.
Kurtosis - algebraic
Expression giving the Kurtosis of this distribution.
Mean - algebraic
Expression giving the Mean of this distribution.
Median - algebraic
Expression giving the Median of this distribution.
MGF - operator
Operator mapping a value t to the MGF of this distribution at t.
MGFNumeric - appliable
Procedure for efficiently computing a floating-point approximation to the MGF.
MillsRatio - operator
Operator mapping a value t to the MillsRatio of this distribution at t.
Mode - algebraic
Expression giving the Mode of this distribution.
Moment - operator
Operator mapping a positive integer n to the nth Moment of this distribution.
PDF - operator
Operator mapping a value t to the PDF of this distribution at t.
PDFNumeric - appliable
Procedure for efficiently computing a floating-point approximation to the PDF.
PFNumeric - appliable
Procedure for efficiently computing a floating-point approximation to the ProbabilityFunction.
ProbabilityFunction - operator
Operator mapping a value t to the ProbabilityFunction of this distribution at t.
Quantile - operator
Operator mapping a value t between 0 and 1 to the tth Quantile of this distribution.
QuantileNumeric - appliable
Procedure for efficiently computing a floating-point approximation to the Quantile.
RandomSample - appliable
Procedure for efficiently computing a random sample of this distribution. The procedure should accept all of the calling sequences that Sample accepts:
When called with a non-negative integer argument n, the procedure should return the sample as a Vector of length n having datatype = float.
When called with an integer range or a list of integer ranges, the procedure should return the sample as an Array with those dimensions having datatype = float.
When called with any rtable having datatype = float, the procedure should return the sample in that rtable.
RousseeuwCrouxQn - algebraic
Expression giving Rousseeuw and Croux' Qn of this distribution.
RousseeuwCrouxSn - algebraic
Expression giving Rousseeuw and Croux' Sn of this distribution.
Skewness - algebraic
Expression giving the Skewness of this distribution.
Specialize - appliable
Procedure returning the distribution that Specialize of this distribution will return. The procedure should take a list of equations as its single argument, and return a new distribution data structure; the most convenient way to produce one is to call Distribution itself.
StandardDeviation - algebraic
Expression giving the StandardDeviation of this distribution.
StandardizedMoment - operator
Operator mapping a positive integer n to the nth StandardizedMoment of this distribution.
SFNumeric - appliable
Procedure for efficiently computing the SurvivalFunction of this distribution.
Support - algebraic .. algebraic
Range containing the Support of this distribution. If a DiscreteValueMap is specified, then this should be the support in the source domain. See the DiscreteValueMap help page for more details. If the Support is not given explicitly, an attempt is made to infer the Support from the PDF or the ProbabilityFunction, falling back to the default value of −∞..∞ if this attempt fails.
SurvivalFunction - operator
Operator mapping a value t to the SurvivalFunction of this distribution at t.
Type - equal to either discrete or continuous
Indicates whether the distribution is discrete (meaning it can only assume finitely or countably many values, each with positive probability) or continuous (meaning the probability for it to assume any particular value is 0). The default value for this property is continuous; it cannot be FAIL. For discrete distributions that can assume non-integer values, you will need to specify a DiscreteValueMap. See the DiscreteValueMap help page for more details.
Variance - algebraic
Expression giving the Variance of this distribution.
with⁡Statistics:
Create a Gamma distribution.
G≔Distribution⁡GammaDistribution⁡a,b
G ≔ moduleoptionDistribution,Continuous;exportConditions,Dimensions,ParentName,Parameters,CharacteristicFunction,CGF,Mean,Mode,MGF,PDF,Support,Variance,CDFNumeric,QuantileNumeric,RandomSample,RandomSampleSetup,RandomVariate,MaximumLikelihoodEstimate;end module
Y≔RandomVariable⁡G
Y≔_R
PDF⁡Y,c
0c<0cab−1⁢ⅇ−caa⁢Γ⁡botherwise
Create a new distribution.
U≔Distribution⁡`=`⁡PDF,t↦f⁡t,`=`⁡CDF,t↦F⁡t,Mean=3
U ≔ moduleoptionDistribution,Continuous;exportCDF,Conditions,PDF,Mean;end module
Z≔RandomVariable⁡U
Z≔_R0
PDF⁡Z,t
f⁡t
CDF⁡Z,t
F⁡t
MGF⁡Z,t
∫−∞∞ⅇ_t⁢t⁢f⁡_tⅆ_t
Mean⁡Z
3
Moment⁡Z,1
Moment⁡Z,2
∫−∞∞_t02⁢f⁡_t0ⅆ_t0
The following is effectively a reimplementation of the BetaDistribution with parameters 1 and 3. We reimplement the numeric CDF procedure, so that we can call trace in order to see when it is used.
myPDF≔unapply⁡PDF⁡BetaDistribution⁡1,3,t,t
myPDF≔t↦0t<03⋅1−t2t<10otherwise
myCDFNumeric := proc(t) return evalf(piecewise(t<0, 0, t<1, 3*t*hypergeom([-2, 1], [2], t), 1)); end proc; trace(myCDFNumeric):
myCDFNumeric ≔ proctreturnevalf⁡piecewise⁡t<0,0,t<1,3*t*hypergeom⁡−2,1,2,t,1end proc
dist≔Distribution⁡PDF=myPDF,CDFNumeric=myCDFNumeric
dist ≔ moduleoptionDistribution,Continuous;exportConditions,CDFNumeric,PDF;end module
X≔RandomVariable⁡dist
X≔_R2
This does not call the numeric CDF procedure - only the regular one (which in this case integrates the PDF expression symbolically):
CDF⁡X,12
78
But these calling sequences do lead to a call to myCDFNumeric:
CDF⁡X,0.5
{--> enter q, args = .5 <-- exit q (now in GetValue) = .8749999998}
0.8749999998
CDF⁡X,12,numeric
{--> enter q, args = 1/2 <-- exit q (now in GetValue) = .8750000000}
0.8750000000
For Median, it also depends on the numeric option (coincidentally, this call runs via Quantile):
Median⁡X
−2232+1
Median⁡X,numeric
{--> enter q, args = 0. <-- exit q (now in extproc) = 0.} {--> enter q, args = .25 <-- exit q (now in extproc) = .578124999999975} {--> enter q, args = .25 <-- exit q (now in extproc) = .578124999999975} {--> enter q, args = 0. <-- exit q (now in extproc) = 0.} {--> enter q, args = .25 <-- exit q (now in extproc) = .578124999999975} {--> enter q, args = .216216216216226 <-- exit q (now in extproc) = .518508281839222} {--> enter q, args = .206102270110636 <-- exit q (now in extproc) = .499627215365731} {--> enter q, args = .206301958179384 <-- exit q (now in extproc) = .500004694760124} {--> enter q, args = .206299474633007 <-- exit q (now in extproc) = .50000000116623} {--> enter q, args = .206299474015915 <-- exit q (now in extproc) = .500000000000049} {--> enter q, args = .206299474015889 <-- exit q (now in extproc) = .499999999999986}
0.206299474015889
We create a parameterized distribution with PDF a⁢t at appropriate values t. The parameter a must be a positive real number.
parameterizedPDF≔unapply⁡piecewise⁡t<0,0,t<root⁡94⁢a,3,sqrt⁡a⁢t,0,t
parameterizedPDF≔t↦0t<0a⋅tt<1813⋅1a1320otherwise
parameterized≔Distribution⁡PDF=parameterizedPDF,Conditions=0<a
parameterized ≔ moduleoptionDistribution,Continuous;exportConditions,PDF;end module
By setting infolevel, we can see when these assumptions are used.
infolevelStatistics≔2
PDF⁡parameterized,t
Statistics:-PDF -- using the following implicit assumptions: {0 < a}
0t<0a⁢tt<1813⁢1a1320otherwise
It turns out that the Kurtosis of this distribution is independent of a.
kurtosis≔Kurtosis⁡parameterized
Statistics:-Kurtosis -- using the following implicit assumptions: {0 < a}
kurtosis≔14⁢12287⁢213⁢323−11823⁢181311⁢63⁢223⁢313−25⁢18232
simplify⁡kurtosis
20399
The speed distribution for the molecules of an ideal gas.
assume⁡0<m,0<k,0<T
σ≔sqrt⁡k⁢Tm
σ≔k~⁢T~m~
f≔simplify⁡piecewise⁡x<0,0,sqrt⁡2πσ3⁢x2⁢exp⁡−x22⁢σ2
f≔0x<02⁢m~32⁢x2⁢ⅇ−x2⁢m~2⁢k~⁢T~π⁢k~32⁢T~320≤x
MD≔Distribution⁡PDF=unapply⁡f,x
MD ≔ moduleoptionDistribution,Continuous;exportConditions,PDF;end module
Create random variable having this distribution.
X≔RandomVariable⁡MD
X≔_R5
Compute average molecular speed.
Mean⁡X
2⁢T~⁢k~⁢2m~⁢π
Compare with the Maxwell distribution.
Mean⁡Maxwell⁡σ
2⁢2⁢k~⁢T~m~π
Compute average kinetic energy.
simplify⁡ExpectedValue⁡12⁢m⁢X2
3⁢k~⁢T~2
Helium at 25C.
g≔eval⁡f,T=298.15,k=evalf⁡ScientificConstants:-Constant⁡k,m=4.×10−27
g≔0x<05.404283672×10−10⁢2⁢x2⁢ⅇ−4.858610154×10−7⁢x20≤x
α≔eval⁡σ,T=298.15,k=evalf⁡ScientificConstants:-Constant⁡k,m=4.×10−27
α≔1014.446097
He≔Distribution⁡PDF=unapply⁡g,x:
XHe≔RandomVariable⁡He:
Most probable speed.
Mode⁡XHe
1434.643427
Mode⁡Maxwell⁡α
1434.643428
Use simulation to verify the results.
A≔Sample⁡XHe,105,method=envelope,range=0..5000:
Mode⁡A
1479.23422185382
P≔DensityPlot⁡XHe,range=0..3500,thickness=3,color=red:
Q≔Histogram⁡A,range=0..3500:
plotsdisplay⁡P,Q
Stuart, Alan, and Ord, Keith. Kendall's Advanced Theory of Statistics. 6th ed. London: Edward Arnold, 1998. Vol. 1: Distribution Theory.
The Statistics[Distribution] command was updated in Maple 16.
See Also
Statistics[Computation]
Statistics[Distributions]
Statistics[RandomVariable]
Download Help Document