Statistics - Maple Programming Help

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

 > with(Statistics):

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

 > X := RandomVariable(Normal(a, b));
 ${X}{≔}{\mathrm{_R}}$ (1)
 > PDF(X, t);
 $\frac{\sqrt{{2}}{}{{ⅇ}}^{{-}\frac{{\left({t}{-}{a}\right)}^{{2}}}{{2}{}{{b}}^{{2}}}}}{{2}{}\sqrt{{\mathrm{\pi }}}{}{b}}$ (2)
 > Mean(X);
 ${a}$ (3)
 ${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 := RandomVariable(T);
 ${Y}{≔}{\mathrm{_R0}}$ (5)
 > PDF(Y, t);
 $\left\{\begin{array}{cc}{0}& {t}{<}{0}\\ \frac{{\left(\frac{{t}}{{u}}\right)}^{{v}{-}{1}}{}{{ⅇ}}^{{-}\frac{{t}}{{u}}}}{{u}{}{\mathrm{\Gamma }}{}\left({v}\right)}& {\mathrm{otherwise}}\end{array}\right\$ (6)
 > U := Distribution(PDF = (t -> piecewise(t < 0, 0, t < 3, 1/3, 0)));
 ${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{PDF}}{,}{\mathrm{Conditions}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (7)
 > Z := RandomVariable(U);
 ${Z}{≔}{\mathrm{_R1}}$ (8)
 > PDF(Z, t);
 $\left\{\begin{array}{cc}{0}& {t}{<}{0}\\ \frac{{1}}{{3}}& {t}{<}{3}\\ {0}& {\mathrm{otherwise}}\end{array}\right\$ (9)
 > Mean(Z);
 $\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.