CentralMoment[data,r]
gives the order r
central moment
of data.
CentralMoment[data,{r1,…,rm}]
gives the order {r1,…,rm} multivariate central moment
of data.
CentralMoment[dist,…]
gives the central moment of the distribution dist.
represents the order r
formal central moment.
CentralMoment
CentralMoment[data,r]
gives the order r
central moment
of data.
CentralMoment[data,{r1,…,rm}]
gives the order {r1,…,rm} multivariate central moment
of data.
CentralMoment[dist,…]
gives the central moment of the distribution dist.
represents the order r
formal central moment.
Details
- CentralMoment is also known as a moment about the mean.
- For scalar order r and data being an array
, with mean (first raw moment)
: -
![x in TemplateBox[{Vectors, paclet:ref/Vectors}, RefLink, BaseStyle -> {3ColumnTableMod}][n] x in TemplateBox[{Vectors, paclet:ref/Vectors}, RefLink, BaseStyle -> {3ColumnTableMod}][n]](Files/CentralMoment.en/7.png)

sum of r
powers »![x in TemplateBox[{Matrices, paclet:ref/Matrices}, RefLink, BaseStyle -> {3ColumnTableMod}][{n,m}] x in TemplateBox[{Matrices, paclet:ref/Matrices}, RefLink, BaseStyle -> {3ColumnTableMod}][{n,m}]](Files/CentralMoment.en/10.png)

columnwise sum of r
central powers »![x in TemplateBox[{Arrays, paclet:ref/Arrays}, RefLink, BaseStyle -> {3ColumnTableMod}][{n_(1),...,n_(k)}] x in TemplateBox[{Arrays, paclet:ref/Arrays}, RefLink, BaseStyle -> {3ColumnTableMod}][{n_(1),...,n_(k)}]](Files/CentralMoment.en/13.png)

columnwise sum of r
central powers » - CentralMoment[x,r] is equivalent to ArrayReduce[CentralMoment[#,r]&,x,1].
- For vector order {r1,…,rm} and data being array
, with first raw moment
: -
![x in TemplateBox[{Matrices, paclet:ref/Matrices}, RefLink, BaseStyle -> {3ColumnTableMod}][{n,m}] x in TemplateBox[{Matrices, paclet:ref/Matrices}, RefLink, BaseStyle -> {3ColumnTableMod}][{n,m}]](Files/CentralMoment.en/18.png)

sum the rj
central power in the j
column![x in TemplateBox[{Arrays, paclet:ref/Arrays}, RefLink, BaseStyle -> {3ColumnTableMod}][{n_(1),...,n_(k)}] x in TemplateBox[{Arrays, paclet:ref/Arrays}, RefLink, BaseStyle -> {3ColumnTableMod}][{n_(1),...,n_(k)}]](Files/CentralMoment.en/22.png)

sum the rj
central power in the j
column » - CentralMoment[x,{r1,…,rm}] is equivalent to ArrayReduce[CentralMoment[#,
]&,x,{{1},{2}}]. - CentralMoment handles both numerical and symbolic data.
- The data can have the following additional forms and interpretations:
-
Association the values (the keys are ignored) » WeightedData weighted mean, based on the underlying EmpiricalDistribution » EventData based on the underlying SurvivalDistribution » TimeSeries, TemporalData, … vector or array of values (the time stamps ignored) » Image,Image3D RGB channels' values or grayscale intensity value » Audio amplitude values of all channels » DateObject, TimeObject list of dates or list of times » - For a distribution dist, the r
central moment is given by Expectation[(x-Mean[dist])r,xdist]. » - For a multivariate distribution dist, the {r1,…,rm}
central moment is given by Expectation[(x1-μ1)r1⋯(x2-μm)rm,{x1,…,xm}dist] and {μ1,…,μm}=Mean[dist]. » - For a random process proc, the central moment function can be computed for slice distribution at time t, SliceDistribution[proc,t], as
[t]=CentralMoment[SliceDistribution[proc,t],r]. » - CentralMoment[r] can be used in functions such as MomentConvert and MomentEvaluate, etc. »
Examples
open all close allBasic Examples (3)
Compute central moments from data:
data = RandomVariate[LogNormalDistribution[1, 1], 10 ^ 5];CentralMoment[data, 3]CentralMoment[{Subscript[x, 1], Subscript[x, 2], Subscript[x, 3]}, 2]Central moment of a list of dates:
CentralMoment[{Yesterday, Today, Tomorrow}, 4]Compute the second central moment of a univariate distribution:
CentralMoment[GammaDistribution[α, β], 2]The central moment
of a multivariate distribution:
CentralMoment[DirichletDistribution[{Subscript[α, 1], Subscript[α, 2], Subscript[α, 3]}], {1, 1}]Scope (26)
Basic Uses (6)
Exact input yields exact output:
CentralMoment[{1, 2, 3, 4}, 4]CentralMoment[{π, E, 2}, 2]//TogetherApproximate input yields approximate output:
CentralMoment[{1., 2., 3., 4.}, 2]CentralMoment[N[{1, 2, 3, 4}, 30], 2]Find central moments of WeightedData:
CentralMoment[WeightedData[{1, 2, 3}, {Subscript[w, 1], Subscript[w, 2], Subscript[w, 3]}], 2]data = {8, 3, 5, 4, 9, 0, 4, 2, 2, 3};
weights = {0.15, 0.09, 0.12, 0.10, 0.16, 0., 0.11, 0.08, 0.08, 0.09};CentralMoment[WeightedData[data, weights], 2]Find a central moment of EventData:
e = {1.0, 2.1, 3.2, 4.5, 5.7};
ci = {0, 0, 0, 1, 0};CentralMoment[EventData[e, ci], 2]Find a central moment of TimeSeries:
CentralMoment[TemporalData[TimeSeries, {{{2.3, 1.2, 6.7, 5.8, 7.1, 4.6}}, {{0, 5, 1}}, 1, {"Discrete", 1},
{"Discrete", 1}, 1, {}}, False, 10.], 2]Central moment depends only on the values:
CentralMoment[TemporalData[TimeSeries, {{{2.3, 1.2, 6.7, 5.8, 7.1, 4.6}}, {{0, 5, 1}}, 1, {"Discrete", 1},
{"Discrete", 1}, 1, {}}, False, 10.]["Values"], 2]Find a central moment for data involving quantities:
data = Quantity[RandomReal[1, 6], "Meters"]CentralMoment[data, 2]Array Data (5)
For a matrix, CentralMoment gives columnwise moments:
CentralMoment[(| | |
| ----- | ----- |
| a1, 1 | a1, 2 |
| a2, 1 | a2, 2 |), 4]//SimplifyFor an array, CentralMoment gives columnwise moments at the first level:
CentralMoment[Array[Subscript[a, ##]&, {2, 2, 2}], 2]//Simplify//MatrixFormMultivariate CentralMoment for an array:
CentralMoment[Array[Subscript[a, ##]&, {2, 2, 2}], {2, 2}]//SimplifyCentralMoment[RandomReal[1, 10 ^ 7], 2]CentralMoment[RandomReal[1, {10 ^ 6, 5}], 2]When the input is an Association, CentralMoment works on its values:
mat = RandomReal[1, {3, 2}];
assoc = AssociationThread[Range[3], mat]CentralMoment[assoc, 3]SparseArray data can be used just like dense arrays:
CentralMoment[SparseArray[{{1} -> 1, {100} -> 1}], 4]CentralMoment[SparseArray[{{1, 1} -> 1, {2, 2} -> 2, {3, 3} -> 3, {1, 3} -> 4}], 2]Find the central moment of a QuantityArray:
data = QuantityArray[RandomReal[1, 6], "Pounds"]CentralMoment[data, 5]Image and Audio Data (2)
Channelwise central moment of an RGB image:
CentralMoment[[image], 5]RGBColor[%]Central moment intensity value of a grayscale image:
CentralMoment[[image], 4]On audio objects, CentralMoment works channelwise:
a = ExampleData[{"Audio", "Bee"}]AudioMeasurements[a, "Channels"]CentralMoment[a, 3]Date and Time (4)
Compute central moment of dates:
dates = WolframLanguageData[All, "DateIntroduced"];DateHistogram[dates]CentralMoment[dates, 4]UnitConvert[%, "Decades" ^ 4]Compute the weighted central moment of dates:
dates = RandomDate[4]weights = {1, 1, 1, 3};CentralMoment[WeightedData[dates, weights], 3]UnitConvert[%, "Years" ^ 3]Compute the central moment of dates given in different calendars:
dates = {DateObject[{2024, 2, 29}, CalendarType -> "Julian"], DateObject[{1524, 1, 1}, CalendarType -> "Islamic"], DateObject[{6024, 1, 15}, CalendarType -> "Jewish"]}CentralMoment[dates, 2]UnitConvert[%, "Years" ^ 2]Variance[dates]UnitConvert[%, "Years" ^ 2]Compute the central moment of times:
RandomTime[3]CentralMoment[%, 4]List of times with different time zone specifications:
{TimeObject[{12}, TimeZone -> 0], TimeObject[{12}, TimeZone -> 2], TimeObject[{12}, TimeZone -> "Asia/Tokyo"]}CentralMoment[%, 3]Distribution and Process Moments (5)
Scalar central moment for univariate distributions:
CentralMoment[BinomialDistribution[n, p], 2]//TogetherCentralMoment[NormalDistribution[μ, σ], 2]Scalar central moment for multivariate distributions:
CentralMoment[BinormalDistribution[{Subscript[μ, 1], Subscript[μ, 2]}, {Subscript[σ, 1], Subscript[σ, 2]}, ρ], 2]CentralMoment[DirichletDistribution[{a, b, c}], 3]Joint central moment for multivariate distributions:
CentralMoment[MultinomialDistribution[n, {Subscript[p, 1], Subscript[p, 2], Subscript[p, 3]}], {1, 1, 1}]CentralMoment[BinormalDistribution[{Subscript[μ, 1], Subscript[μ, 2]}, {Subscript[σ, 1], Subscript[σ, 2]}, ρ], {2, 2}]Compute a central moment for a symbolic order r:
CentralMoment[BetaDistribution[a, b], r]A central moment may only evaluate for specific orders:
CentralMoment[ExtremeValueDistribution[a, b], r]% /. r -> 3A central moment may only evaluate numerically:
CentralMoment[VonMisesDistribution[Pi / 2, 2], 4]N[%]Central moments for derived distributions:
CentralMoment[TransformedDistribution[x^2, xNormalDistribution[μ, σ]], 2]CentralMoment[ProbabilityDistribution[(Sqrt[2] / π)(1 / (1 + (x - 2)^4)), {x, -∞, ∞}], 2]data = RandomVariate[NormalDistribution[], 10 ^ 3];CentralMoment[HistogramDistribution[data], 4]Central moment function for a random process:
CentralMoment[BrownianBridgeProcess[μ, σ][t], 4]Plot[Evaluate[% /. {μ -> 3, σ -> 1}], {t, 0, 1}, PlotRange -> All]Find a central moment of TemporalData at some time t=0.5:
td = RandomFunction[WienerProcess[1, 1], {0, 10, 0.05}, 100]CentralMoment[td[0.5], 2]Find the corresponding central moment function together with all the simulations:
Show[ListLinePlot[td, PlotStyle -> Directive[Opacity[0.2], Thin]], Plot[CentralMoment[td[t], 2], {t, 0, 10}, PlotStyle -> Thick]]Formal Moments (4)
TraditionalForm formatting for formal moments:
CentralMoment[r]//TraditionalFormCentralMoment[{p, q, r}]//TraditionalFormConvert combinations of formal moments to an expression involving CentralMoment:
MomentConvert[Moment[2], CentralMoment]//TraditionalFormMomentConvert[Moment[2]Cumulant[2], CentralMoment]//TraditionalFormEvaluate an expression involving formal moments
for a distribution:
MomentEvaluate[CentralMoment[2] + CentralMoment[4], PoissonDistribution[λ]]data = RandomVariate[PoissonDistribution[1], 10^4];MomentEvaluate[CentralMoment[2] + Moment[4], data]Find a sample estimator for an expression involving CentralMoment:
(estimator = MomentConvert[CentralMoment[2], "UnbiasedSampleEstimator"])//TraditionalFormEvaluate the resulting estimator for data:
data = RandomVariate[PoissonDistribution[1], 10^4];MomentEvaluate[estimator, data]Applications (11)
The first central moment is always 0:
data = RandomReal[{-7, 3}, 100];CentralMoment[data, 1]The second central moment is a measure of dispersion:
𝒟 = NormalDistribution[0, σ];CentralMoment[𝒟, 2]Table[Plot[PDF[𝒟, x], {x, -4, 4}, PlotRange -> {0, 0.4}, Filling -> Axis, Ticks -> {Automatic, None}], {σ, {1, 1.5, 2}}]The third central moment is a measure of skewness:
dists = {NormalDistribution[0, 2.5], ChiSquareDistribution[5], GumbelDistribution[3, 2]};Table[CentralMoment[dists[[i]], 3], {i, 3}]//NTable[Plot[PDF[dists[[i]], x], {x, -7, 15}, PlotRange -> {0, 0.2}, Filling -> Axis, Ticks -> {Automatic, None}], {i, 3}]Estimate parameters of a distribution using the method of moments:
data = RandomVariate[GammaDistribution[3, 6], 10 ^ 4];meq = Table[CentralMoment[data, k] == CentralMoment[GammaDistribution[α, β], k], {k, 2, 3}]NSolve[meq, {α, β}]Compare data and the estimated parametric distribution:
Show[Histogram[data, Automatic, "ProbabilityDensity"], Plot[Evaluate[PDF[GammaDistribution[α, β], x] /. %], {x, 0, 100}, PlotStyle -> Thick]]Find a normal approximation to GammaDistribution using the method of moments:
gdist = GammaDistribution[α, β];meq = {Moment[gdist, 1] == Moment[NormalDistribution[μ, σ], 1], CentralMoment[gdist, 2] == CentralMoment[NormalDistribution[μ, σ], 2]}Solve[(And@@meq)∧σ > 0, {μ, σ}, Reals]{ndist} = Refine[NormalDistribution[μ, σ] /. %, β > 0∧α > 0]Compare an original and an approximated distribution:
Plot[{PDF[gdist, x], PDF[ndist, x]} /. {α -> 13, β -> 3}, {x, 0, 80}, Evaluated -> True]Construct a sample estimator of the second central moment:
estim = MomentConvert[CentralMoment[2], "SampleEstimator"]Find its sample distribution expectation, assuming sample size
:
MomentConvert[estim, {CentralMoment, n}]Find sample distribution variance of the estimator:
MomentConvert[(estim - %) ^ 2, {CentralMoment, n}]Variance of the estimator for uniformly distributed sample:
MomentEvaluate[%, UniformDistribution[{0, 1}]]The law of large numbers states that a sample moment approaches population moment as sample size increases. Use Histogram to show the probability distribution of a second sample central moment of uniform random variates for different sample sizes:
Histogram[Table[CentralMoment[RandomReal[1, {n, 2 * 10 ^ 3}], 2], {n, {10, 10^2, 10^3}}], 30, "ProbabilityDensity", ChartLegends -> {10, 10^2, 10^3}]Edgeworth expansion for near-normal data correcting for third and fourth central moments:
pdf = (Exp[-(x^2/2)]/Sqrt[2 π]) (1 + ((-6 Sqrt[2] x + 2 Sqrt[2] x^3) CentralMoment[3]/12 Sqrt[2]) + (1/576) (-120 + 360 x^2 - 120 x^4 + 8 x^6) CentralMoment[3]^2 + (1/96) (12 - 24 x^2 + 4 x^4) (-3 + CentralMoment[4]));data = Standardize[Total[RandomReal[1, {3, 10 ^ 5}]]];dist = ProbabilityDistribution[MomentEvaluate[pdf, data], {x, -∞, ∞}]{NExpectation[x ^ 3, xdist], NExpectation[x ^ 4, xdist]}{CentralMoment[data, 3], CentralMoment[data, 4]}Show[Histogram[data, Automatic, "ProbabilityDensity"], Plot[{PDF[dist, z], PDF[NormalDistribution[], z]}, {z, -3, 3}, PlotStyle -> {Directive[Thick], Directive[Dashed, Red]}]]Function computing sample Jarque–Bera statistics [link]:
JarqueBera[list_] := With[{cm2 = CentralMoment[list, 2]}, (Length[list]/6)((CentralMoment[list, 3]^2/cm2^3) + (1/4)((CentralMoment[list, 4]/cm2^2) - 3)^2)]Accumulate statistics on samples of normal random variates:
data = Table[JarqueBera[RandomVariate[NormalDistribution[], 2 * 10^3]], {2 * 10^3}];Compare the statistics histogram with an asymptotic distribution:
Show[
Histogram[data, 30, "ProbabilityDensity"],
Plot[PDF[ChiSquareDistribution[2], x], {x, 0, 20}, PlotRange -> All]]Compute a moving central moment for some data:
data = TemporalData[TimeSeries, {{{0., 0.007220215826254015, -0.028898335552430553, -0.24236658577144637,
-0.05412788592296647, -0.03667481168713718, -0.17138823136819967, -0.3007558946785308,
-0.43687938826754796, -0.3573927720423709, -0.345586 ... 33201685, -1.2078738741401542, -1.1504147295751919,
-1.1306360665338737}}, {{0, 1., 0.01}}, 1, {"Continuous", 1}, {"Continuous", 1}, 1,
{ValueDimensions -> 1, ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False,
10.1];md = MovingMap[CentralMoment[#, 2]&, data, {.1}];ListLinePlot[md, PlotRange -> All]Compute central moments for slices of a collection of paths of a random process:
data = RandomFunction[WienerProcess[], {0, 1, .01}, 10 ^ 3];times = Range[0, 1, .1];cm = Map[{#, CentralMoment[data[#], 2]}&, times];Plot central moments over these paths:
Show[ListPlot[data], ListLinePlot[cm, PlotStyle -> Green]]Properties & Relations (11)
Central moments are translation invariant:
CentralMoment[ExponentialDistribution[λ], 5]CentralMoment[TransformedDistribution[x + a, xExponentialDistribution[λ]], 5]The second central moment is a scaled Variance:
data = RandomReal[10, 20];Variance[data] (Length[data] - 1) / Length[data]CentralMoment[data, 2]The odd moments of 2×2 matrices vanish:
CentralMoment[(| | |
| ----- | ----- |
| a1, 1 | a1, 2 |
| a2, 1 | a2, 2 |), 5]//SimplifyFor a multivariate order, the total order must be odd:
CentralMoment[(| | |
| ----- | ----- |
| a1, 1 | a1, 2 |
| a2, 1 | a2, 2 |), {2, 3}]//SimplifyThe multivariate central moment of an array of depth
has depth
:
arr = Array[Subscript[a, Row@{##}]&, {n = 4, m = 3, 2, 3}];
rs = {2, 2, 2};
Length[rs] == mCentralMoment[arr, rs] ==
ArrayReduce[Mean,
ArrayReduce[Times@@Power[#, rs]&,
(*Centralize*)
arr - TensorProduct[ConstantArray[1, n], Mean[arr]],
2],
1]//SimplifySqrt of the second central moment is RootMeanSquare of deviations from the Mean:
Sqrt[CentralMoment[{a, b, c, d}, 2]]RootMeanSquare[{a, b, c, d} - Mean[{a, b, c, d}]]Skewness is a ratio of powers of third and second central moments:
data = RandomReal[10, 10];Skewness[data]CentralMoment[data, 3] / CentralMoment[data, 2] ^ (3 / 2)Kurtosis is a ratio of powers of fourth and second central moments:
data = RandomReal[10, 10];Kurtosis[data]CentralMoment[data, 4] / CentralMoment[data, 2] ^ 2CentralMoment is equivalent to an Expectation of a power of a random variable around its mean:
list = Range[100];Expectation[(x - Mean[list]) ^ 5, xlist] == CentralMoment[list, 5]dist = PoissonDistribution[μ];Expectation[(x - Mean[dist]) ^ 5, xdist] == CentralMoment[dist, 5]CentralMoment of order
is equivalent to
when both exist:
cmgf = CentralMomentGeneratingFunction[LaplaceDistribution[0, 1], t]SeriesCoefficient[cmgf, {t, 0, r}]r!Use CentralMoment directly:
CentralMoment[LaplaceDistribution[0, 1], r]Find the central moment–generating function by using GeneratingFunction:
GeneratingFunction[CentralMoment[ExponentialDistribution[λ], r] / r!, r, t, Assumptions -> λ > 0]Compare with direct evaluation of CentralMomentGeneratingFunction:
CentralMomentGeneratingFunction[ExponentialDistribution[λ], t]FullSimplify[% - %%]CentralMoment can be expressed in terms of Moment, Cumulant, or FactorialMoment:
MomentConvert[CentralMoment[4], Cumulant]MomentConvert[CentralMoment[4], Moment]MomentConvert[CentralMoment[2], FactorialMoment]Possible Issues (2)
Central moments of higher order are undefined for a heavy-tailed distribution:
Table[CentralMoment[StudentTDistribution[3], r], {r, 2, 5}]Compute central moments on 5 independent samples of the distribution:
data = RandomVariate[StudentTDistribution[3], {10 ^ 5, 5}];Sample central moments of higher order exhibit wild fluctuations:
ListLogPlot[Abs@Table[CentralMoment[data, r], {r, 2, 5}], Joined -> True]Sample estimators of central moments are biased:
MomentConvert[CentralMoment[2], "SampleEstimator"]//TraditionalFormFind sampling population expectation assuming a sample of size
:
MomentConvert[%, {CentralMoment, n}]The estimator is asymptotically unbiased:
Limit[%, n -> ∞]Construct an unbiased estimator:
MomentConvert[CentralMoment[2], "UnbiasedEstimator", "PowerSymmetricPolynomial"]//TraditionalFormThe expected value of the estimator is the central moment for all sample sizes:
MomentConvert[%, {CentralMoment, n}]Neat Examples (1)
The distribution of CentralMoment estimates for 20, 100, and 300 samples:
CentralMoment[ExponentialDistribution[0.9], 2]SmoothHistogram[Table[CentralMoment[RandomVariate[ExponentialDistribution[0.9], {s, 1000}], 2], {s, {20, 100, 300}}], Filling -> Axis, PlotLegends -> {20, 100, 300}, PlotRange -> {{0, 4}, Automatic}]Tech Notes
Related Workflows
- Analyze a Computable Dataset
History
Introduced in 2007 (6.0) | Updated in 2010 (8.0) ▪ 2024 (14.0) ▪ 2024 (14.1)
Text
Wolfram Research (2007), CentralMoment, Wolfram Language function, https://reference.wolfram.com/language/ref/CentralMoment.html (updated 2024).
CMS
Wolfram Language. 2007. "CentralMoment." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/CentralMoment.html.
APA
Wolfram Language. (2007). CentralMoment. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CentralMoment.html
BibTeX
@misc{reference.wolfram_2026_centralmoment, author="Wolfram Research", title="{CentralMoment}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/CentralMoment.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_centralmoment, organization={Wolfram Research}, title={CentralMoment}, year={2024}, url={https://reference.wolfram.com/language/ref/CentralMoment.html}, note=[Accessed: 13-June-2026]}