Student[Statistics] - Maple Programming Help

Home : Support : Online Help : Education : Student Packages : Statistics : Random Variable Distributions : Student/Statistics/EmpiricalRandomVariable

Student[Statistics]

 EmpiricalRandomVariable
 Empirical random variable

 Calling Sequence EmpiricalRandomVariable(sample, opts)

Parameters

 sample - a list or rtable of samples opts - (optional) an equation of the form probabilities = plist

Description

 • The empirical random variable is a discrete probability distribution with probability function generated from the given sample.
 • If opts is not given, then Maple assigns a probability to each variate present within the sample equal to the fraction of occurrences of that value within the entire sample. If opts is specified, then plist should be a list or rtable of probabilities (nonnegative real numbers adding up to 1), having equally many entries as sample; the ith entry of plist specifies the probability for the ith entry of sample.

Examples

 > $\mathrm{with}\left({\mathrm{Student}}_{\mathrm{Statistics}}\right):$
 > $P≔\left[1,1,1,2,2,2.5,3,4,4,5.5\right]:$
 > $X≔\mathrm{EmpiricalRandomVariable}\left(P\right):$
 > $\mathrm{ProbabilityFunction}\left(X,1\right)$
 $\frac{{3}}{{10}}$ (1)
 > $\mathrm{ProbabilityFunction}\left(X,5\right)$
 ${0}$ (2)
 > $\mathrm{ProbabilityFunction}\left(X,5.5\right)$
 $\frac{{1}}{{10}}$ (3)
 > $\mathrm{ProbabilityFunction}\left(X,1,\mathrm{output}=\mathrm{plot}\right)$
 > $\mathrm{CDF}\left(X,\frac{9}{2}\right)$
 $\frac{{9}}{{10}}$ (4)
 > $\mathrm{CDF}\left(X,x,\mathrm{output}=\mathrm{plot}\right)$
 > $\mathrm{Mean}\left(X\right)$
 ${2.60000000000000}$ (5)
 > $\mathrm{Variance}\left(X\right)$
 ${2.090000000}$ (6)

Specify the probabilities.

 > $M≔\mathrm{Matrix}\left(\left[\left[1,2,3\right],\left[3.5,4,5\right]\right]\right)$
 ${M}{≔}\left[\begin{array}{ccc}{1}& {2}& {3}\\ {3.5}& {4}& {5}\end{array}\right]$ (7)
 > $\mathrm{pmatrix}≔\mathrm{Matrix}\left(\left[\left[\frac{1}{15},\frac{2}{15},\frac{5}{15}\right],\left[\frac{4}{15},\frac{1}{15},\frac{2}{15}\right]\right]\right)$
 ${\mathrm{pmatrix}}{≔}\left[\begin{array}{ccc}\frac{{1}}{{15}}& \frac{{2}}{{15}}& \frac{{1}}{{3}}\\ \frac{{4}}{{15}}& \frac{{1}}{{15}}& \frac{{2}}{{15}}\end{array}\right]$ (8)
 > $Y≔\mathrm{EmpiricalRandomVariable}\left(M,\mathrm{probabilities}=\mathrm{pmatrix}\right):$
 > $\mathrm{ProbabilityFunction}\left(Y,x,\mathrm{output}=\mathrm{plot}\right)$
 > $\mathrm{ProbabilityFunction}\left(Y,3.5\right)$
 $\frac{{4}}{{15}}$ (9)
 > $\mathrm{CDF}\left(Y,x,\mathrm{output}=\mathrm{plot}\right)$
 > $\mathrm{CDF}\left(Y,4\right)$
 $\frac{{13}}{{15}}$ (10)
 > $\mathrm{Median}\left(Y\right)$
 ${3}$ (11)

References

 Evans, Merran; Hastings, Nicholas; and Peacock, Brian. Statistical Distributions. 3rd ed. Hoboken: Wiley, 2000.
 Johnson, Norman, L.; Kotz, Samuel; and Balakrishnan, N. Continuous Univariate Distributions. 2nd ed. 2 vols. Hoboken: Wiley, 1995.
 Stuart, Alan, and Ord, Keith. Kendall's Advanced Theory of Statistics. 6th ed. London: Edward Arnold, 1998. Vol. 1: Distribution Theory.

Compatibility

 • The Student[Statistics][EmpiricalRandomVariable] command was introduced in Maple 18.