Variance - Maple Help

Student[Statistics]

 Variance
 compute the variance

 Calling Sequence Variance(A, numeric_options) Variance(M, numeric_options) Variance(X, numeric_options, inert_option)

Parameters

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

Description

 • The Variance function computes the sample variance of the specified data sample or random variable. In the data sample case the following (unbiased) estimate for the variance is used:

$\frac{\sum _{i=1}^{N}{\left({A}_{i}-\mathrm{Mean}\left(A\right)\right)}^{2}}{N-1}$

 where N is the number of elements per data set A.
 • The first parameter can be a data set, a random variable, or an algebraic expression involving random variables (see Student[Statistics][RandomVariable]).
 • 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 variance 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 variance of the beta distribution with parameters $p$ and $q$.

 > $\mathrm{Variance}\left(\mathrm{BetaRandomVariable}\left(p,q\right)\right)$
 $\frac{{p}{}{q}}{{\left({p}{+}{q}\right)}^{{2}}{}\left({p}{+}{q}{+}{1}\right)}$ (1)

Use numeric parameters.

 > $\mathrm{Variance}\left(\mathrm{BetaRandomVariable}\left(3,5\right)\right)$
 $\frac{{5}}{{192}}$ (2)
 > $\mathrm{Variance}\left(\mathrm{BetaRandomVariable}\left(3,5\right),\mathrm{numeric}\right)$
 ${0.02604166667}$ (3)

Use the inert option.

 > $\mathrm{Variance}\left(\mathrm{BetaRandomVariable}\left(3,5\right),\mathrm{inert}\right)$
 ${{\int }}_{{0}}^{{1}}{105}{}{\left({\mathrm{_t0}}{-}\left({{\int }}_{{0}}^{{1}}{105}{}{{\mathrm{_t}}}^{{3}}{}{\left({1}{-}{\mathrm{_t}}\right)}^{{4}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{\mathrm{_t}}\right)\right)}^{{2}}{}{{\mathrm{_t0}}}^{{2}}{}{\left({1}{-}{\mathrm{_t0}}\right)}^{{4}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{\mathrm{_t0}}$ (4)
 > $\mathrm{evalf}\left(\mathrm{Variance}\left(\mathrm{BetaRandomVariable}\left(3,5\right),\mathrm{inert}\right)\right)$
 ${0.02604166667}$ (5)
 > $\mathrm{Variance}\left(\left[x,y,z\right]\right)$
 $\frac{{\left(\frac{{2}{}{x}}{{3}}{-}\frac{{y}}{{3}}{-}\frac{{z}}{{3}}\right)}^{{2}}}{{2}}{+}\frac{{\left(\frac{{2}{}{y}}{{3}}{-}\frac{{x}}{{3}}{-}\frac{{z}}{{3}}\right)}^{{2}}}{{2}}{+}\frac{{\left(\frac{{2}{}{z}}{{3}}{-}\frac{{x}}{{3}}{-}\frac{{y}}{{3}}\right)}^{{2}}}{{2}}$ (6)

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

 > $\mathrm{Variance}\left(\left[1,4,4.0,0.1,\mathrm{sqrt}\left(3\right)\right]\right)$
 ${3.13583376511232}$ (7)

Consider the following Matrix data sample.

 > $M≔\mathrm{Matrix}\left(\left[\left[4,110,\mathrm{\pi }\right],\left[\mathrm{undefined},4.9,0\right],\left[4,995,a\right]\right]\right)$
 ${M}{≔}\left[\begin{array}{ccc}{4}& {110}& {\mathrm{\pi }}\\ {\mathrm{undefined}}& {4.9}& {0}\\ {4}& {995}& {a}\end{array}\right]$ (8)

Compute the variance of each of the columns.

 > $\mathrm{Variance}\left(M\right)$
 $\left[\begin{array}{ccc}{\mathrm{undefined}}& {295761.503333333}& \frac{{\left(\frac{{2}{}{\mathrm{\pi }}}{{3}}{-}\frac{{a}}{{3}}\right)}^{{2}}}{{2}}{+}\frac{{\left({-}\frac{{\mathrm{\pi }}}{{3}}{-}\frac{{a}}{{3}}\right)}^{{2}}}{{2}}{+}\frac{{\left(\frac{{2}{}{a}}{{3}}{-}\frac{{\mathrm{\pi }}}{{3}}\right)}^{{2}}}{{2}}\end{array}\right]$ (9)

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][Variance] command was introduced in Maple 18.