Main Content

mean

Mean of probability distribution

Description

example

m = mean(pd) returns the mean m of the probability distribution pd.

Examples

collapse all

Load the sample data. Create a vector containing the first column of students’ exam grade data.

load examgrades
x = grades(:,1);

Create a normal distribution object by fitting it to the data.

pd = fitdist(x,'Normal')
pd = 
  NormalDistribution

  Normal distribution
       mu = 75.0083   [73.4321, 76.5846]
    sigma =  8.7202   [7.7391, 9.98843]

The distribution object display includes the parameter estimates for the mean (mu) and standard deviation (sigma), and the 95% confidence intervals for the parameters.

Compute the mean of the fitted distribution.

m = mean(pd)
m = 75.0083

The mean of the normal distribution is equal to the parameter mu.

Create a Weibull probability distribution object.

pd = makedist('Weibull','A',5,'B',2)
pd = 
  WeibullDistribution

  Weibull distribution
    A = 5
    B = 2

Compute the mean of the distribution.

mean = mean(pd)
mean = 4.4311

Create a uniform distribution object

pd = makedist('Uniform','lower',-3,'upper',5)
pd = 
  UniformDistribution

  Uniform distribution
    Lower = -3
    Upper =  5

Compute the mean of the distribution.

m = mean(pd)
m = 1

Load the sample data. Create a probability distribution object by fitting a kernel distribution to the miles per gallon (MPG) data.

load carsmall;
pd = fitdist(MPG,'Kernel')
pd = 
  KernelDistribution

    Kernel = normal
    Bandwidth = 4.11428
    Support = unbounded

Compute the mean of the distribution.

mean(pd)
ans = 23.7181

Input Arguments

collapse all

Probability distribution, specified as one of the probability distribution objects in this table.

Distribution ObjectFunction or App to Create Probability Distribution Object
BetaDistributionmakedist, fitdist, Distribution Fitter
BinomialDistributionmakedist, fitdist, Distribution Fitter
BirnbaumSaundersDistributionmakedist, fitdist, Distribution Fitter
BurrDistributionmakedist, fitdist, Distribution Fitter
ExponentialDistributionmakedist, fitdist, Distribution Fitter
ExtremeValueDistributionmakedist, fitdist, Distribution Fitter
GammaDistributionmakedist, fitdist, Distribution Fitter
GeneralizedExtremeValueDistributionmakedist, fitdist, Distribution Fitter
GeneralizedParetoDistributionmakedist, fitdist, Distribution Fitter
HalfNormalDistributionmakedist, fitdist, Distribution Fitter
InverseGaussianDistributionmakedist, fitdist, Distribution Fitter
KernelDistributionfitdist, Distribution Fitter
LogisticDistributionmakedist, fitdist, Distribution Fitter
LoglogisticDistributionmakedist, fitdist, Distribution Fitter
LognormalDistributionmakedist, fitdist, Distribution Fitter
LoguniformDistributionmakedist
MultinomialDistributionmakedist
NakagamiDistributionmakedist, fitdist, Distribution Fitter
NegativeBinomialDistributionmakedist, fitdist, Distribution Fitter
NormalDistributionmakedist, fitdist, Distribution Fitter
PiecewiseLinearDistributionmakedist
PoissonDistributionmakedist, fitdist, Distribution Fitter
RayleighDistributionmakedist, fitdist, Distribution Fitter
RicianDistributionmakedist, fitdist, Distribution Fitter
StableDistributionmakedist, fitdist, Distribution Fitter
tLocationScaleDistributionmakedist, fitdist, Distribution Fitter
TriangularDistributionmakedist
UniformDistributionmakedist
WeibullDistributionmakedist, fitdist, Distribution Fitter

Output Arguments

collapse all

Mean of the probability distribution, returned as a scalar value.

Extended Capabilities

Introduced in R2013a