Statistics - Maple Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Statistics and Data Analysis : Statistics Package : Random Variables : Statistics/RandomVariable

Statistics

 RandomVariable
 create new random variable

 Calling Sequence RandomVariable(T)

Parameters

 T - ProbabilityDistribution; probability distribution

Description

 • The RandomVariable command creates new random variable with the specified distribution.
 • The parameter can be one of the supported distributions or a distribution data structure.

Examples

 > $\mathrm{with}\left(\mathrm{Statistics}\right):$

Create a random variable which is normally distributed with mean a and standard deviation b.

 > $X≔\mathrm{RandomVariable}\left(\mathrm{Normal}\left(a,b\right)\right)$
 ${X}{:=}{\mathrm{_R}}$ (1)
 > $\mathrm{PDF}\left(X,t\right)$
 $\frac{{1}}{{2}}{}\frac{\sqrt{{2}}{}{{ⅇ}}^{{-}\frac{{1}}{{2}}{}\frac{{\left({t}{-}{a}\right)}^{{2}}}{{{b}}^{{2}}}}}{\sqrt{{\mathrm{π}}}{}{b}}$ (2)
 > $\mathrm{Mean}\left(X\right)$
 ${a}$ (3)
 > $T≔\mathrm{Distribution}\left(\mathrm{GammaDistribution}\left(u,v\right)\right)$
 ${T}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{option}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{Distribution}}{,}{\mathrm{Continuous}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{export}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{Conditions}}{,}{\mathrm{ParentName}}{,}{\mathrm{Parameters}}{,}{\mathrm{CharacteristicFunction}}{,}{\mathrm{CGF}}{,}{\mathrm{Mean}}{,}{\mathrm{Mode}}{,}{\mathrm{MGF}}{,}{\mathrm{PDF}}{,}{\mathrm{Support}}{,}{\mathrm{Variance}}{,}{\mathrm{CDFNumeric}}{,}{\mathrm{QuantileNumeric}}{,}{\mathrm{RandomSample}}{,}{\mathrm{RandomSampleSetup}}{,}{\mathrm{RandomVariate}}{,}{\mathrm{MaximumLikelihoodEstimate}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (4)
 > $Y≔\mathrm{RandomVariable}\left(T\right)$
 ${Y}{:=}{\mathrm{_R0}}$ (5)
 > $\mathrm{PDF}\left(Y,t\right)$
 ${{}\begin{array}{cc}{0}& {t}{<}{0}\\ \frac{{\left(\frac{{t}}{{u}}\right)}^{{v}{-}{1}}{}{{ⅇ}}^{{-}\frac{{t}}{{u}}}}{{u}{}{\mathrm{Γ}}{}\left({v}\right)}& {\mathrm{otherwise}}\end{array}$ (6)
 > $U≔\mathrm{Distribution}\left(\mathrm{PDF}=\left(t→\mathrm{piecewise}\left(t<0,0,t<3,\frac{1}{3},0\right)\right)\right)$
 ${U}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{option}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{Distribution}}{,}{\mathrm{Continuous}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{export}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{Conditions}}{,}{\mathrm{PDF}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (7)
 > $Z≔\mathrm{RandomVariable}\left(U\right)$
 ${Z}{:=}{\mathrm{_R1}}$ (8)
 > $\mathrm{PDF}\left(Z,t\right)$
 ${{}\begin{array}{cc}{0}& {t}{<}{0}\\ \frac{{1}}{{3}}& {t}{<}{3}\\ {0}& {\mathrm{otherwise}}\end{array}$ (9)
 > $\mathrm{Mean}\left(Z\right)$
 $\frac{{3}}{{2}}$ (10)

References

 Stuart, Alan, and Ord, Keith. Kendall's Advanced Theory of Statistics. 6th ed. London: Edward Arnold, 1998. Vol. 1: Distribution Theory.

 See Also

## Was this information helpful?

 Please add your Comment (Optional) E-mail Address (Optional) What is ? This question helps us to combat spam