WOLFRAM

Mean[data]

gives the mean estimate of the elements in data.

Mean[dist]

gives the mean of the distribution dist.

Details

  • Mean is also known as an expectation or average.
  • Mean is a location measure for data or distributions.
  • For VectorQ data , the mean estimate is given by .
  • For MatrixQ data, the mean estimate is computed for each column vector with Mean[{{x1,y1,},{x2,y2,},}] equivalent to {Mean[{x1,x2,}],Mean[{y1,y2,}],}. »
  • For ArrayQ data, the mean estimate is equivalent to ArrayReduce[Mean,data,1]. »
  • For WeightedData[{x1,x2,},{w1,w2,}], the mean estimate is given by . »
  • Mean handles both numerical and symbolic data.
  • The data can have the following additional forms and interpretations:
  • Associationthe values (the keys are ignored) »
    WeightedDataweighted mean, based on the underlying EmpiricalDistribution »
    EventDatabased on the underlying SurvivalDistribution »
    TimeSeries, TemporalData, vector or array of values (the time stamps ignored) »
    Image,Image3DRGB channels values or grayscale intensity value »
    Audioamplitude values of all channels »
    DateObject,TimeObjectlist of dates or list of times »
  • For a list of dates , the mean is given by , which is date plus sum of durations .
  • For a univariate distribution dist, the mean is given by μ=Expectation[x,xdist]. »
  • For multivariate distribution dist, the mean is given by {μx ,μy,}=Expectation[{x,y,},{x,y,}dist]. »
  • For a random process proc, the mean function can be computed for slice distribution at time t, SliceDistribution[proc,t], as μ[t]=Mean[SliceDistribution[proc,t]]. »

Examples

open allclose all

Basic Examples  (5)Summary of the most common use cases

Mean of numeric values:

Out[1]=1

Mean of symbolic values:

Out[1]=1

Means of elements in each column:

Out[1]=1

Mean of a list of dates:

Out[1]=1
Out[2]=2

Mean of a parametric distribution:

Out[1]=1

Scope  (22)Survey of the scope of standard use cases

Basic Uses  (6)

Exact input yields exact output:

Out[1]=1
Out[2]=2

Approximate input yields approximate output:

Out[1]=1
Out[2]=2

Find the mean of WeightedData:

Out[1]=1
Out[3]=3

Find the mean of EventData:

Out[2]=2

Find the mean of a TimeSeries:

Out[2]=2

The mean depends only on the values:

Out[3]=3

Compute a weighted mean:

Out[4]=4

Find the mean of data involving quantities:

Out[1]=1
Out[2]=2

Array Data  (5)

Mean for a matrix gives columnwise means:

Out[1]=1

Mean for a arrays gives columnwise means at the first level:

Out[2]=2

Works with large arrays:

Out[1]=1
Out[2]=2

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

Out[1]=1
Out[2]=2

SparseArray data can be used just like dense arrays:

Out[1]=1
Out[2]=2
Out[3]=3
Out[4]=4

Find mean of a QuantityArray:

Out[1]=1
Out[2]=2

Image and Audio Data  (2)

Channel-wise mean value of an RGB image:

Out[1]=1
Out[2]=2

Mean intensity value of a grayscale image:

Out[3]=3

On audio objects, Mean works channel-wise:

Out[1]=1
Out[2]=2
Out[3]=3

Date and Time  (4)

Compute mean of dates:

Out[5]=5
Out[6]=6

Compute the weighted mean of dates:

Out[1]=1
Out[3]=3

Compute the mean of dates given in different calendars:

Out[1]=1
Out[2]=2

The mean is given in one of the input calendars:

Out[3]=3
Out[4]=4

Compute the mean of times:

Out[1]=1
Out[2]=2

List of times with different time zone specifications:

Out[3]=3
Out[4]=4
Out[5]=5

Distributions and Processes  (5)

Find the mean for univariate distributions:

Out[1]=1
Out[2]=2

Multivariate distributions:

Out[3]=3
Out[4]=4

Mean for derived distributions:

Out[1]=1
Out[2]=2

Data distribution:

Out[4]=4

Mean for distributions with quantities:

Out[1]=1
Out[2]=2
Out[3]=3

Mean function for a continuous-time random and discrete-state process:

Out[1]=1
Out[2]=2

Find the mean of TemporalData at some time t=0.5:

Out[1]=1
Out[2]=2

Find the mean function together with all the simulations:

Out[3]=3

Applications  (11)Sample problems that can be solved with this function

Basic Applications  (5)

The mean represents the center of mass for a distribution:

Out[2]=2

The mean for distributions without a single mode:

Out[2]=2

The mean for multivariate distributions:

Out[2]=2

Mean values of cells in a sequence of steps of 2D cellular automaton evolution:

Out[1]=1

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

Choose a few slice times:

Plot means over these paths:

Out[4]=4

Applications  (6)

Find the mean height for the children in a class:

Out[2]=2
Out[3]=3
Out[4]=4

Find the mean height for the children in a class:

Out[2]=2
Out[3]=3
Out[4]=4

Find the mean strength for 480 samples of ceramic material:

Out[2]=2
Out[3]=3

Plot a Histogram for the data with mean position highlighted:

Out[5]=5

Compute the probability that the strength exceeds the mean:

Out[6]=6

Compute the mean lifetime for a quantity subject to exponential decay with rate :

Out[1]=1

Smooth an irregularly spaced time series by computing a moving mean:

A 90-day moving mean:

Out[3]=3

A vacuum system in a small electron accelerator contains 20 vacuum bulbs arranged in a circle. The vacuum system fails if at least 3 adjacent vacuum bulbs fail:

Plot the survival function:

Out[5]=5

Compute the mean time to failure:

Out[6]=6

Properties & Relations  (17)Properties of the function, and connections to other functions

Mean is Total divided by Length:

Out[1]=1
Out[2]=2

Mean is equivalent to a 1norm divided by Length for positive values:

Out[2]=2
Out[3]=3

Mean of WeightedData is equivalent to the mean of the EmpiricalDistribution of the data:

Out[1]=1
Out[2]=2
Out[3]=3
Out[4]=4

Mean of EventData is equivalent to the mean of the SurvivalDistribution of the data:

Out[1]=1
Out[2]=2
Out[3]=3
Out[4]=4

For nearly symmetric samples, Mean and Median are nearly the same:

Out[1]=1
Out[2]=2
Out[4]=4
Out[5]=5

The Mean of absolute deviations from the Mean is MeanDeviation:

Out[2]=2
Out[3]=3

Mean is logarithmically related to GeometricMean for positive values:

Out[1]=1
Out[2]=2

Mean is the inverse of HarmonicMean of the inverse of the data:

Out[2]=2
Out[3]=3

The square root of Mean of the data squared is RootMeanSquare:

Out[2]=2

The n^(th) CentralMoment is the Mean of deviations raised to the n^(th) power:

Out[1]=1
Out[2]=2

Variance is a scaled Mean of squared deviations from the Mean:

Out[2]=2
Out[3]=3

Expectation for a list is a Mean:

Out[1]=1
Out[2]=2

MovingAverage is a sequence of means:

Out[1]=1
Out[2]=2

A 0% TrimmedMean is the same as Mean:

Out[1]=1
Out[2]=2

The Expectation of a random variable in a distribution is the Mean:

Out[1]=1
Out[2]=2

LocationTest tests whether the mean is close to 0:

Out[2]=2

The probability () value:

Out[3]=3
Out[4]=4

LocationEquivalenceTest tests for equivalence of means in two or more datasets:

Out[2]=2

The probability () value:

Out[3]=3
Out[4]=4

Possible Issues  (1)Common pitfalls and unexpected behavior

Outliers can have a disproportionate effect on Mean:

Out[1]=1

Use TrimmedMean to ignore a fraction of the smallest and largest elements:

Out[2]=2

Use Median as something much less sensitive to outliers:

Out[3]=3

Neat Examples  (1)Surprising or curious use cases

The distribution of Mean estimates for 10, 100, and 300 samples:

(2) Out[1]=2
Wolfram Research (2003), Mean, Wolfram Language function, https://reference.wolfram.com/language/ref/Mean.html (updated 2024).
Wolfram Research (2003), Mean, Wolfram Language function, https://reference.wolfram.com/language/ref/Mean.html (updated 2024).

Text

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

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

CMS

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

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

APA

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

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

BibTeX

@misc{reference.wolfram_2025_mean, author="Wolfram Research", title="{Mean}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/Mean.html}", note=[Accessed: 29-May-2025 ]}

@misc{reference.wolfram_2025_mean, author="Wolfram Research", title="{Mean}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/Mean.html}", note=[Accessed: 29-May-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_mean, organization={Wolfram Research}, title={Mean}, year={2024}, url={https://reference.wolfram.com/language/ref/Mean.html}, note=[Accessed: 29-May-2025 ]}

@online{reference.wolfram_2025_mean, organization={Wolfram Research}, title={Mean}, year={2024}, url={https://reference.wolfram.com/language/ref/Mean.html}, note=[Accessed: 29-May-2025 ]}