
7.2 Moment Matching and Maximum Likelihood Estimators 235
Note that both the likelihood and log-likelihood are maximized at the same
value.
For the alternative parametrization of exponentials via a scale parameter,
as in MATLAB, f (x
|λ) =
1
λ
e
−x/λ
, the estimator is, of course,
ˆ
λ
mle
= X .
An important property of MLE is their invariance property.
Invariance Property of MLEs. Let
ˆ
θ
mle
be an MLE of θ and let η =
g(θ), where g is an arbitrary function. Then
ˆ
η
mle
= g(
ˆ
θ
mle
) is an MLE of
η.
For example, if the MLE for
λ in the exponential distribution was 1/X , then
for a function of the parameter
η =λ
2
−sin(λ) the MLE is (1/X )
2
−sin
³
1/X
´
.
In MATLAB, the function
mle finds the MLE when inputs are data and
the name of a distribution with a list of options. The normal distribution is
the default. For example,
parhat = mle(data) calculates the MLE for µ and σ
of a normal distribution, evaluated at vector data. One of the outputs is the
confidence interval. For example,
[parhat, parci] = mle(data) returns MLEs
and 95% confidence intervals for the parameters. The confidence intervals,
as interval estimators, will be discussed later in this chapter. The command
[...] = mle(data,’distribution’,dist) computes parameter estimations for
the distribution specified by
dist. Acceptable strings for dist are as follows:
’beta’ ’bernoulli’ ’binomial’
’discrete uniform’ ’exponential’ ’extreme value’
’gamma’ ’generalized extreme value’ ’generalized pareto’
’geometric’ ’lognormal’ ’negative binomial’
’normal’ ’poisson’ ’rayleigh’
’uniform’ ’weibull’
Example 7.3. MLE of Beta in MATLAB. The following MATLAB commands
show how to estimate parameters a and b in a beta distribution. We will simu-
late a sample of size 1000 from a beta
B e(2, 3) distribution and then from the
sample find MLEs of a and b.
a = betarnd( 2, 3,[1, 1000]);
thetahat = mle(a,’distribution’, ’beta’)
%thetahat = 1.9991 3.0267
It is possible to find the MLE using MATLAB’s mle command for distribu-
tions that are not on the list. The code is given at the end of Example 7.4in
which moment-matching estimators and MLEs for parameters in a Maxwell
distribution are compared.