Student[Statistics] - Maple Programming Help

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

Student[Statistics]

 Moment
 compute moments

 Calling Sequence Moment(A, n, numeric_option, origin_option) Moment(M, nn, numeric_option, origin_option) Moment(X, n, numeric_option, origin_option, inert_option)

Parameters

 A - M - X - algebraic; random variable n - algebraic; order nn - algebraic, list or Vector of algebraic constants; order, or sequence of orders numeric_option - (optional) equation of the form numeric=value where value is true or false origin_option - (optional) equation of the form origin=algebraic where algebraic is a algebraic expression or a list or Vector of algebraic expressions. inert_option - (optional) equation of the form inert=value where value is true or false

Description

 • The Moment function computes the moment of order n of the specified random variable or data sample.
 • The first parameter can be a data sample (e.g., a Vector), a Matrix data sample, a random variable, or an algebraic expression involving random variables (see Student[Statistics][RandomVariable]).
 • The second parameter can be any algebraic expression.
 • origin=algebraic -- By default, the moment is computed about 0. If this option is present, the moment will be calculated about the specified point. If A is a Matrix data sample, then you can specify several origins instead, one for each column of the Matrix. This is accomplished by passing a list or Vector as the value of the origin option.
 • 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).
 • 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 moment is computed according to the rules mentioned above. To always compute the moment numerically, specify the numeric or numeric = true option.

Examples

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

Compute the fourth moment of the beta distribution with parameters 4 and 7.

 > $\mathrm{Moment}\left(\mathrm{BetaRandomVariable}\left(4,7\right),4\right)$
 $\frac{{5}}{{143}}$ (1)
 > $\mathrm{Moment}\left(\mathrm{BetaRandomVariable}\left(4,7\right),4,\mathrm{numeric}\right)$
 ${0.03496503497}$ (2)
 > $\mathrm{Moment}\left(\mathrm{BetaRandomVariable}\left(4,7\right),2,\mathrm{origin}=\frac{1}{2}\right)$
 $\frac{{5}}{{132}}$ (3)
 > $\mathrm{Moment}\left(\mathrm{BetaRandomVariable}\left(4,7\right),2,\mathrm{origin}=\frac{1}{2},\mathrm{numeric}\right)$
 ${0.03787878788}$ (4)

Use named value for second parameter or origin option.

 > $\mathrm{Moment}\left(\mathrm{BetaRandomVariable}\left(4,7\right),a,\mathrm{origin}=1\right)$
 $\frac{{5040}{}{\left({-1}\right)}^{{a}}}{\left({a}{+}{7}\right){}\left({a}{+}{8}\right){}\left({a}{+}{9}\right){}\left({a}{+}{10}\right)}$ (5)
 > $\mathrm{Moment}\left(\mathrm{BetaRandomVariable}\left(4,7\right),2,\mathrm{origin}=b\right)$
 $\frac{{5}}{{33}}{-}\frac{{8}}{{11}}{}{b}{+}{{b}}^{{2}}$ (6)

Use the inert option.

 > $\mathrm{Moment}\left(\mathrm{BetaRandomVariable}\left(4,7\right),2,\mathrm{origin}=\frac{1}{2},\mathrm{inert}\right)$
 ${{\int }}_{{0}}^{{1}}{840}{}{\left({\mathrm{_t1}}{-}\frac{{1}}{{2}}\right)}^{{2}}{}{{\mathrm{_t1}}}^{{3}}{}{\left({1}{-}{\mathrm{_t1}}\right)}^{{6}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{\mathrm{_t1}}$ (7)
 > $\mathrm{evalf}\left(\mathrm{Moment}\left(\mathrm{BetaRandomVariable}\left(4,7\right),2,\mathrm{origin}=\frac{1}{2},\mathrm{inert}\right)\right)$
 ${0.03787878788}$ (8)

Create a exponential-distributed random variable $X$ and compute the third moment of $\frac{1}{X+2}$.

 > $X≔\mathrm{ExponentialRandomVariable}\left(2\right):$
 > $\mathrm{Moment}\left(\frac{1}{X+2},3,\mathrm{numeric}\right)$
 ${0.03727171015}$ (9)

Compute the second moment of the following data, and set the origin to be 3.

 > $A≔⟨0,2,3,5,2,\mathrm{\pi },2,-4,\mathrm{ln}\left(2\right)⟩$
 ${A}{≔}\left[\begin{array}{c}{0}\\ {2}\\ {3}\\ {5}\\ {2}\\ {\mathrm{\pi }}\\ {2}\\ {-4}\\ {\mathrm{ln}}{}\left({2}\right)\end{array}\right]$ (10)
 > $\mathrm{Moment}\left(A,2,\mathrm{origin}=3\right)$
 $\frac{{65}}{{9}}{+}\frac{{\left({\mathrm{\pi }}{-}{3}\right)}^{{2}}}{{9}}{+}\frac{{\left({\mathrm{ln}}{}\left({2}\right){-}{3}\right)}^{{2}}}{{9}}$ (11)

Consider the following Matrix data sample.

 > $M≔\mathrm{Matrix}\left(\left[\left[3,\mathrm{\pi },114\right],\left[5.0,3,-12\right],\left[\mathrm{ln}\left(4\right),\mathrm{ln}\left(5\right),88\right],\left[2,5,54\right],\left[4.2,23,17\right]\right]\right)$
 ${M}{≔}\left[\begin{array}{ccc}{3}& {\mathrm{\pi }}& {114}\\ {5.0}& {3}& {-12}\\ {2}{}{\mathrm{ln}}{}\left({2}\right)& {\mathrm{ln}}{}\left({5}\right)& {88}\\ {2}& {5}& {54}\\ {4.2}& {23}& {17}\end{array}\right]$ (12)

Compute the second moment of each of the columns.

 > $\mathrm{Moment}\left(M,2\right)$
 $\left[\begin{array}{ccc}{11.51236241}& \frac{{563}}{{5}}{+}\frac{{{\mathrm{\pi }}}^{{2}}}{{5}}{+}\frac{{{\mathrm{ln}}{}\left({5}\right)}^{{2}}}{{5}}& \frac{{24089}}{{5}}\end{array}\right]$ (13)

Compute the second moment of each column with origin 3.

 > $\mathrm{Moment}\left(M,2,'\mathrm{origin}=3'\right)$
 $\left[\begin{array}{ccc}{1.808809178}& \frac{{404}}{{5}}{+}\frac{{\left({\mathrm{\pi }}{-}{3}\right)}^{{2}}}{{5}}{+}\frac{{\left({\mathrm{ln}}{}\left({5}\right){-}{3}\right)}^{{2}}}{{5}}& \frac{{22568}}{{5}}\end{array}\right]$ (14)

Compute the moment of each column with corresponding order and origin.

 > $\mathrm{Moment}\left(M,\left[2,3,1\right],'\mathrm{origin}=\left[3,100,85\right]'\right)$
 $\left[\begin{array}{ccc}{1.808809178}& {-}\frac{{2226581}}{{5}}{+}\frac{{\left({\mathrm{\pi }}{-}{100}\right)}^{{3}}}{{5}}{+}\frac{{\left({\mathrm{ln}}{}\left({5}\right){-}{100}\right)}^{{3}}}{{5}}& {-}\frac{{164}}{{5}}\end{array}\right]$ (15)

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