Moment

Moment[list,r]

gives the r^(th) sample moment of the elements in list.

Moment[dist,r]

gives the r^(th) moment of the distribution dist.

Moment[,{r1,r2,}]

gives the {r1,r2,}^(th) multivariate moment.

Moment[r]

represents the r^(th) formal moment.

Details

  • Moment is also known as a raw moment.
  • Moment handles both numerical and symbolic data.
  • For the list {x1,x2,,xn}, the r^(th) moment is given by .
  • Moment[{{x1,y1,},,{xn,yn,}},{rx,ry,}] gives .
  • Moment works with SparseArray objects.
  • For a distribution dist, the r^(th) moment is given by Expectation[xr,xdist].
  • For a multivariate distribution dist, the {r1,r2,}^(th) moment is given by Expectation[x1r1x2r2,{x1,x2,}dist].
  • Moment[r] can be used in functions such as MomentConvert and MomentEvaluate, etc.

Examples

open allclose all

Basic Examples  (2)

Compute moments from data:

Use symbolic data:

Compute the second moment of a univariate distribution:

The moment for a multivariate distribution:

Scope  (18)

Data Moments  (9)

Exact input yields exact output:

Approximate input yields approximate output:

Moment for a matrix gives columnwise means:

Moment for a tensor gives columnwise means at the first level:

Works with large arrays:

SparseArray data can be used just like dense arrays:

Find moments of WeightedData:

Find a moment of EventData:

Find a moment of TimeSeries:

The moment depends only on the values:

Find a moment for data involving quantities:

Distribution and Process Moments  (5)

Find the moments for univariate distributions:

Multivariate distributions:

Compute a moment for a symbolic order r:

A moment may only evaluate for specific orders:

A moment may only evaluate numerically:

Moments for derived distributions:

Data distribution:

Moment function for a random process:

Find a moment of TemporalData at some time t=0.5:

Find the corresponding moment function together with all the simulations:

Formal Moments  (4)

TraditionalForm formatting for formal moments:

Convert combinations of formal moments to an expression involving Moment:

Evaluate an expression involving formal moments μ2+μ3 for a distribution:

Evaluate for data:

Find a sample estimator for an expression involving Moment:

Evaluate the resulting estimator for data:

Applications  (10)

Moments for Data and Time Series  (3)

The law of large numbers states that a sample moment approaches a population moment as the sample size increases. Use Histogram to show probability distribution of a second sample moment of uniform random variates for different sample sizes:

Visualize the convergence process:

Compute a moving moment for some data:

Use the window of length .1:

Compute moments for slices of a collection of paths of a random process:

Choose a few slice times:

Plot the fourth moments over these paths:

Method of Moments  (3)

Estimate parameters of a distribution using the method of moments:

Compare data and estimated parametric distribution:

Find normal approximation to GammaDistribution using the method of moments:

Show how and depend on and :

Compare original and approximated distribution:

Moments of PearsonDistribution satisfy a three-term recurrence equation implied by the defining differential equation for the density function :

Verify the moment equations:

Use the recurrence equation to express parameters of PearsonDistribution in terms of its moments:

Fit PearsonDistribution to data:

Check that moments of the resulting distribution are equal to moments of data:

PDF Approximations from Moments  (3)

Two different distributions can have the same sequence of moments:

Compare their densities on log-scale:

Compute their moments:

Prove them equal:

Build type A GramCharlier expansion of order 6:

A monotone PDF with a positive domain is bounded by :

Prove the identity for exponential distribution for the first few orders:

Expectation Approximation from Moments  (1)

Find quadrature rule for approximating the expectation of a function of a random variable:

Find lowest-order orthogonal polynomials:

Check their orthonormality:

Find quadrature points:

Find quadrature weights, requiring rule to be exact on polynomials of order up to :

Compute approximation to expectation of :

Check with NExpectation:

Properties & Relations  (7)

Moment is equivalent to Expectation of an integer power of a random variable:

A multivariate moment is equivalent to Expectation of a multivariate monomial:

Moment of order one is the Mean for univariate distributions:

Mean of a multivariate distribution is a list of moments of its univariate marginal distributions:

Alternatively, use Moment with orders given by unit vectors:

Moment of order is the same as when both exist:

Use Moment directly:

Find the moment-generating function by using GeneratingFunction:

Compare with direct evaluation of MomentGeneratingFunction:

Moment can be expressed through Cumulant, FactorialMoment, or CentralMoment:

Sample moments are unbiased estimators of population moments:

Hence the sampling distribution expectation of the estimator equals the estimated moment:

Verify this on a sample of fixed size; evaluate the estimator on the sample:

Find its expectation assuming independent identically distributed random variables and :

Possible Issues  (2)

Heavy-tailed distributions may only have a few low-order moments defined:

Some heavy-tailed distributions have no moments defined:

Often quantiles can be used to characterize distributions:

Neat Examples  (2)

Find an unbiased estimator for a product of moments:

Check unbiasedness for a special case of on a GammaDistribution:

The distribution of Moment estimates for 20, 100, and 300 samples:

Introduced in 2010
 (8.0)