Moment

Moment[data,r]

gives the order r moment of data.

Moment[data,{r1,,rm}]

gives the order {r1,,rm} multivariate moment of data.

Moment[dist,]

gives the moment of the distribution dist.

Moment[r]

represents the order r formal moment.

Details

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  (22)

Basic Uses  (6)

Exact input yields exact output:

Approximate input yields approximate output:

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:

Array Data  (5)

For a matrix, Moment gives columnwise moments:

For an array, Moment gives columnwise moments at the first level:

Multivariate Moment for an array:

Works with large arrays:

When the input is an Association, Moment works on its values:

SparseArray data can be used just like dense arrays:

Find the moment of a QuantityArray:

Image and Audio Data  (2)

Channelwise moment of an RGB image:

Moment intensity value of a grayscale image:

On audio objects, Moment works channelwise:

Distribution and Process Moments  (5)

Scalar moment for univariate distributions:

Scalar moment for multivariate distributions:

Joint moment for 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 a 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 of a time series 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 the data with the estimated parametric distribution:

Find normal approximation to GammaDistribution using the method of moments:

Show how and depend on and :

Compare the original and the approximated distributions:

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 for all non-negative integer orders:

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  (8)

Moment of order r is equivalent to Expectation of the power r of the random variable:

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

For univariate distributions, Moment of order one is the Mean:

The same is true for data:

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 CentralMoment, Cumulant or FactorialMoment:

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 :

The multivariate moment of an array of depth has depth :

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:

Wolfram Research (2010), Moment, Wolfram Language function, https://reference.wolfram.com/language/ref/Moment.html (updated 2024).

Text

Wolfram Research (2010), Moment, Wolfram Language function, https://reference.wolfram.com/language/ref/Moment.html (updated 2024).

CMS

Wolfram Language. 2010. "Moment." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/Moment.html.

APA

Wolfram Language. (2010). Moment. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Moment.html

BibTeX

@misc{reference.wolfram_2024_moment, author="Wolfram Research", title="{Moment}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/Moment.html}", note=[Accessed: 13-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_moment, organization={Wolfram Research}, title={Moment}, year={2024}, url={https://reference.wolfram.com/language/ref/Moment.html}, note=[Accessed: 13-November-2024 ]}