 Student[Statistics] - Maple Programming Help

Home : Support : Online Help : Education : Student Packages : Statistics : Student/Statistics/Mean

Student[Statistics]

 Mean
 compute the arithmetic mean
 ExpectedValue
 compute the arithmetic mean

 Calling Sequence Mean(A, numeric_option, output_option) Mean(M, numeric_option, output_option) Mean(X, numeric_option, output_option, inert_option)

Parameters

 A - M - X - algebraic; random variable numeric_option - (optional) equation of the form numeric=value where value is true or false output_option - (optional) equation of the form output=x where x is value, plot, or both inert_option - (optional) equation of the form inert=value where value is true or false

Description

 • The Mean function computes and/or plots the arithmetic mean of the specified random variable or data set. This is the same as the expected value of the random variable. The same command can be obtained as  ExpectedValue.
 • The first parameter can be a data sample (e.g., a Vector), a Matrix data set, a random variable, or an algebraic expression involving random variables (see Student[Statistics][RandomVariable]).
 • If the option output is not included or is specified to be output=value, then the function will return the value of the mean. If output=plot is specified, then the function will return a plot of the input data set and its mean. If output=both is specified, then both the value and the plot of the mean will be returned.
 • If the option inert is not included or is specified to be inert=false, then the function will return the actual value of the result. If inert or inert=true is specified, then the function will return the formula of evaluating the actual value.

Computation

 • By default, all computations involving random variables are performed symbolically (see option numeric below).
 • If there are floating point values or the option numeric is included, then the computation is done in floating point. Otherwise the computation is exact.
 • By default, the mean is computed according to the rules mentioned above. To always compute the mean numerically, specify the numeric or numeric = true option.

Examples

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

Compute the mean of data containing floating point values. This leads to a floating point result.

 > $\mathrm{Mean}\left(\left[2,4,4.0\right]\right)$
 ${3.333333333}$ (1)
 > $\mathrm{Mean}\left(\mathrm{Vector}\left[\mathrm{column}\right]\left(\left[\mathrm{sqrt}\left(14.0\right),\mathrm{\pi },33\right]\right)\right)$
 ${13.29441668}$ (2)

Compute the mean of data not containing any floating point values. This leads to an exact result.

 > $\mathrm{Mean}\left(\left[2,4,4\right]\right)$
 $\frac{{10}}{{3}}$ (3)
 > $\mathrm{Mean}\left(\left[100,20,\mathrm{\pi }\right]\right)$
 ${40}{+}\frac{{\mathrm{\pi }}}{{3}}$ (4)
 > $\mathrm{Mean}\left(\mathrm{Vector}\left[\mathrm{row}\right]\left(\left[\mathrm{sqrt}\left(2\right),3,\mathrm{\pi }\right]\right)\right)$
 ${1}{+}\frac{\sqrt{{2}}}{{3}}{+}\frac{{\mathrm{\pi }}}{{3}}$ (5)

Compute the mean of the beta distribution with parameters $p$ and $q$.

 > $\mathrm{Mean}\left(\mathrm{BetaRandomVariable}\left(p,q\right)\right)$
 $\frac{{p}}{{p}{+}{q}}$ (6)

Use numeric parameters.

 > $\mathrm{Mean}\left(\mathrm{BetaRandomVariable}\left(3,5\right)\right)$
 $\frac{{3}}{{8}}$ (7)
 > $\mathrm{Mean}\left(\mathrm{BetaRandomVariable}\left(3,5\right),\mathrm{numeric}\right)$
 ${0.3750000000}$ (8)

Use the inert option.

 > $\mathrm{Mean}\left(\mathrm{BetaRandomVariable}\left(3,5\right),\mathrm{inert}\right)$
 ${{\int }}_{{0}}^{{1}}{105}{}{{\mathrm{_t}}}^{{3}}{}{\left({1}{-}{\mathrm{_t}}\right)}^{{4}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{\mathrm{_t}}$ (9)
 > $\mathrm{evalf}\left(\mathrm{Mean}\left(\mathrm{BetaRandomVariable}\left(3,5\right),\mathrm{inert}\right)\right)$
 ${0.3750000000}$ (10)

If the output=plot option is included, then a plot will be returned.

 > $\mathrm{Mean}\left(\mathrm{BetaRandomVariable}\left(3,5\right),\mathrm{output}=\mathrm{plot}\right)$ Compute the mean of $x$, $y$, $z$.

 > $\mathrm{Mean}\left(\left[x,y,z\right]\right)$
 $\frac{{x}}{{3}}{+}\frac{{y}}{{3}}{+}\frac{{z}}{{3}}$ (11)

Consider the following Matrix data sample with entries that have floating point values.

 > $M≔\mathrm{Matrix}\left(\left[\left[2.0,7.5,10,18\right],\left[3,5\mathrm{ln}\left(2\right),1,\mathrm{\pi }\right],\left[4,2,7,4\right]\right]\right)$
 ${M}{≔}\left[\begin{array}{cccc}{2.0}& {7.5}& {10}& {18}\\ {3}& {5}{}{\mathrm{ln}}{}\left({2}\right)& {1}& {\mathrm{\pi }}\\ {4}& {2}& {7}& {4}\end{array}\right]$ (12)

We compute the mean of each column according to the computation rules. (If a column has floating point values, then a floating point value will be given for that column. Otherwise, it will result in an exact expression.)

 > $\mathrm{Mean}\left(M\right)$
 $\left[\begin{array}{cccc}{3.000000000}& {4.321911968}& {6}& \frac{{22}}{{3}}{+}\frac{{\mathrm{\pi }}}{{3}}\end{array}\right]$ (13)

Using the command ExpectedValue will give the same result.

 > $\mathrm{ExpectedValue}\left(M\right)$
 $\left[\begin{array}{cccc}{3.000000000}& {4.321911968}& {6}& \frac{{22}}{{3}}{+}\frac{{\mathrm{\pi }}}{{3}}\end{array}\right]$ (14)

If the numeric option is included, then a floating point value will be given independently of the presence of floating point numbers in the input.

 > $\mathrm{Mean}\left(\left[1,2,3,4\right],\mathrm{numeric}\right)$
 ${2.50000000000000}$ (15)

If the output=both option is included, then both the value of the mean and its plot will be returned.

 > $\mathrm{mean},\mathrm{graph}≔\mathrm{Mean}\left(\left[1,2,3,4\right],\mathrm{numeric},\mathrm{output}=\mathrm{both}\right)$
 ${\mathrm{mean}}{,}{\mathrm{graph}}{≔}{2.50000000000000}{,}{\mathrm{PLOT}}{}\left({\mathrm{...}}\right)$ (16)
 > $\mathrm{mean}$
 ${2.50000000000000}$ (17)
 > $\mathrm{graph}$ References

 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][Mean] and Student[Statistics][ExpectedValue] commands were introduced in Maple 18.