Math 541: II Maximum Likelihood Estimation

Lecturer: Songfeng Zheng

1 Maximum Likelihood Estimation

Maximum likelihood is a relatively simple method of constructing an for an un- known θ. It was introduced by R. A. Fisher, a great English mathematical statis- tician, in 1912. Maximum likelihood estimation (MLE) can be applied in most problems, it has a strong intuitive appeal, and often yields a reasonable estimator of θ. Furthermore, if the is large, the method will yield an excellent estimator of θ. For these reasons, the method of maximum likelihood is probably the most widely used method of estimation in .

Suppose that the random variables X1, ··· ,Xn form a random sample from a distribution f(x|θ); if X is continuous random , f(x|θ) is pdf, if X is discrete , f(x|θ) is point mass . We use the given symbol — to represent that the distribution also depends on a parameter θ, where θ could be a real-valued unknown parameter or a vector of . For every observed random sample x1, ··· , xn, we define

f(x1, ··· , xn|θ) = f(x1|θ) ··· f(xn|θ) (1)

If f(x|θ) is pdf, f(x1, ··· , xn|θ) is the joint density function; if f(x|θ) is pmf, f(x1, ··· , xn|θ) is the joint . Now we call f(x1, ··· , xn|θ) as the . As we can see, the likelihood function depends on the unknown parameter θ, and it is always denoted as L(θ).

Suppose, for the , that the observed random sample x1, ··· , xn came from a discrete distribution. If an estimate of θ must be selected, we would certainly not consider any value of θ for which it would have been impossible to obtain the x1, ··· , xn that was actually observed. Furthermore, suppose that the probability f(x1, ··· , xn|θ) of obtaining the actual observed data x1, ··· , xn is very high when θ has a particular value, say θ = θ0, and is very small for every other value of θ. Then we would naturally estimate the value of θ to be θ0. When the sample comes from a continuous distribution, it would again be natural to try to find a value of θ for which the probability density f(x1, ··· , xn|θ) is large, and to use this value as an estimate of θ. For any given observed data x1, ··· , xn, we are led by this reasoning to consider a value of θ for which the likelihood function L(θ) is a maximum and to use this value as an estimate of θ.

1 2

The meaning of maximum likelihood is as follows. We choose the parameter that makes the likelihood of having the obtained data at hand maximum. With discrete distributions, the likelihood is the same as the probability. We choose the parameter for the density that maximizes the probability of the data coming from it. Theoretically, if we had no actual data, maximizing the likelihood function will give us a function of n random variables X1, ··· ,Xn, which we shall call “maximum likelihood estimate” θˆ. When there are actual data, the estimate takes a particular numerical value, which will be the maximum likelihood estimator. MLE requires us to maximum the likelihood function L(θ) with respect to the unknown parameter θ. From Eqn. 1, L(θ) is defined as a of n terms, which is not easy to be maximized. Maximizing L(θ) is equivalent to maximizing log L(θ) because log is a monotonic increasing function. We define log L(θ) as log likelihood function, we denote it as l(θ), i.e. Yn Xn l(θ) = log L(θ) = log f(Xi|θ) = log f(Xi|θ) i=1 i=1 Maximizing l(θ) with respect to θ will give us the MLE estimation.

2 Examples

Example 1: Suppose that X is a discrete random variable with the following probability mass function: where 0 ≤ θ ≤ 1 is a parameter. The following 10 independent

X 0 1 2 3 P (X) 2θ/3 θ/3 2(1 − θ)/3 (1 − θ)/3

were taken from such a distribution: (3,0,2,1,3,2,1,0,2,1). What is the maximum likelihood estimate of θ. Solution: Since the sample is (3,0,2,1,3,2,1,0,2,1), the likelihood is

L(θ) = P (X = 3)P (X = 0)P (X = 2)P (X = 1)P (X = 3) × P (X = 2)P (X = 1)P (X = 0)P (X = 2)P (X = 1) (2)

Substituting from the given above, we have à ! à ! à ! à ! Yn 2θ 2 θ 3 2(1 − θ) 3 1 − θ 2 L(θ) = P (Xi|θ) = i=1 3 3 3 3

Clearly, the likelihood function L(θ) is not easy to maximize. 3

Let us look at the log likelihood function

Xn l(θ) = log L(θ) = log P (Xi|θ) i=1 µ 2 ¶ µ 1 ¶ µ 2 ¶ µ 1 ¶ = 2 log + log θ + 3 log + log θ + 3 log + log(1 − θ) + 2 log + log(1 − θ) 3 3 3 3 = C + 5 log θ + 5 log(1 − θ)

where C is a constant which does not depend on θ. It can be seen that the log likelihood function is easier to maximize compared to the likelihood function. Let the of l(θ) with respect to θ be zero:

dl(θ) 5 5 = − = 0 dθ θ 1 − θ

and the solution gives us the MLE, which is θˆ = 0.5. We remember that the method of moment estimation is θˆ = 5/12, which is different from MLE.

Example 2: Suppose³ ´ X1,X2, ··· ,Xn are i.i.d. random variables with density function 1 |x| f(x|σ) = 2σ exp − σ , please find the maximum likelihood estimate of σ. Solution: The log-likelihood function is " # Xn |X | l(σ) = − log 2 − log σ − i i=1 σ Let the derivative with respect to θ be zero: " # P Xn n 0 1 |Xi| n i=1 |Xi| l (σ) = − + 2 = − + 2 = 0 i=1 σ σ σ σ and this gives us the MLE for σ as P n |X | σˆ = i=1 i n Again this is different from the method of moment estimation which is sP n X2 σˆ = i=1 i 2n

Example 3: Use the method of moment to estimate the parameters µ and σ for the normal density ( ) 1 (x − µ)2 f(x|µ, σ2) = √ exp − , 2πσ 2σ2 4

based on a random sample X1, ··· ,Xn. Solution: In this example, we have two unknown parameters, µ and σ, therefore the pa- rameter θ = (µ, σ) is a vector. We first write out the log likelihood function as

Xn · ¸ Xn 1 1 2 n 1 2 l(µ, σ) = − log σ − log 2π − 2 (Xi − µ) = −n log σ − log 2π − 2 (Xi − µ) i=1 2 2σ 2 2σ i=1

Setting the to be 0, we have

∂l(µ, σ) 1 Xn = 2 (Xi − µ) = 0 ∂µ σ i=1

Xn ∂l(µ, σ) n −3 2 = − + σ (Xi − µ) = 0 ∂σ σ i=1 Solving these equations will give us the MLE for µ and σ: v u u 1 Xn t 2 µˆ = X andσ ˆ = (Xi − X) n i=1

This time the MLE is the same as the result of method of moment. From these examples, we can see that the maximum likelihood result may or may not be the same as the result of method of moment. Example 4: The has been used in economics as a model for a density function with a slowly decaying tail:

θ −θ−1 f(x|x0, θ) = θx0x , x ≥ x0, θ > 1

Assume that x0 > 0 is given and that X1,X2, ··· ,Xn is an i.i.d. sample. Find the MLE of θ. Solution: The log-likelihood function is

Xn Xn l(θ) = log f(Xi|θ) = (log θ + θ log x0 − (θ + 1) log Xi) i=1 i=1 Xn = n log θ + nθ log x0 − (θ + 1) log Xi i=1

Let the derivative with respect to θ be zero:

dl(θ) n Xn = + n log x0 − log Xi = 0 dθ θ i=1 5

Solving the equation yields the MLE of θ:

ˆ 1 θMLE = log X − log x0

Example 5: Suppose that X1, ··· ,Xn form a random sample from a uniform distribution on the (0, θ), where of the parameter θ > 0 but is unknown. Please find MLE of θ. Solution: The pdf of each has the following form: ( 1/θ, for 0 ≤ x ≤ θ f(x|θ) = (3) 0, otherwise

Therefore, the likelihood function has the form ( 1 , for 0 ≤ x ≤ θ (i = 1, ··· , n) L(θ) = θn i 0, otherwise

It can be seen that the MLE of θ must be a value of θ for which θ ≥ xi for i = 1, ··· , n and which maximizes 1/θn among all such values. Since 1/θn is a decreasing function of θ, the estimate will be the smallest possible value of θ such that θ ≥ xi for i = 1, ··· , n. This value ˆ is θ = max(x1, ··· , xn), it follows that the MLE of θ is θ = max(X1, ··· ,Xn). It should be remarked that in this example, the MLE θˆ does not seem to be a suitable ˆ estimator of θ. We know that max(X1, ··· ,Xn) < θ with probability 1, and therefore θ surely underestimates the value of θ.

Example 6: Suppose again that X1, ··· ,Xn form a random sample from a uniform distribu- tion on the interval (0, θ), where of the parameter θ > 0 but is unknown. However, suppose now we write the density function as ( 1/θ, for 0 < x < θ f(x|θ) = (4) 0, otherwise

We will prove that in this case, the MLE for θ does not exist. Proof: The only difference between Eqn. 3 and Eqn. 4 is that the value of the pdf at the two endpints 0 and θ has been changed by replacing the weak inequalities in Eqn. 3 with strict inequalities in Eqn. 4. Either equation could be used as the pdf of the uniform distribution.

However, if Eqn. 4 is used as the pdf, then an MLE of θ will be a value of θ for which θ > xi for i = 1, ··· , n and which maximizes 1/θn among all such values. It should be noted that the possible values of θ no longer include the value θ = max(x1, ··· , xn), since θ must be strictly greater than each observed value xi for i = 1, ··· , n. Since θ can be chosen arbitrarily close to the value max(x1, ··· , xn) but cannot be chosen equal to this value, it follows that the MLE of θ does not exist in this case. 6

Example 5 and 6 illustrate one shortcoming of the concept of an MLE. We know that it is irrelevant whether the pdf of the uniform distribution is chosen to be equal to 1/θ over the open interval 0 < x < θ or over the closed interval 0 ≤ x ≤ θ. Now, however, we see that the existence of an MLE depends on this typically irrelevant and unimportant choice. This difficulty is easily avoided in Example 5 by using the pdf given by Eqn. 3 rather than that given by Eqn. 4. In many other problems, as well, in which there is a difficulty of this type in regard to the existence of an MLE, the difficulty can be avoided simply by choosing one particular appropriate version of the pdf to represent the given distribution.

Example 7: Suppose that X1, ··· ,Xn form a random sample from a uniform distribution on the interval (θ, θ + 1), where the value of the parameter θ is unknown (−∞ < θ < ∞). Clearly, the density function is ( 1, for θ ≤ x ≤ θ + 1 f(x|θ) = 0, otherwise We will see that the MLE for θ is not unique. Proof: In this example, the likelihood function is ( 1, for θ ≤ x ≤ θ + 1 (i = 1, ··· , n) L(θ) = i 0, otherwise

The condition that θ ≤ xi for i = 1, ··· , n is equivalent to the condition that θ ≤ min(x1, ··· , xn). Similarly, the condition that xi ≤ θ + 1 for i = 1, ··· , n is equivalent to the condition that θ ≥ max(x1, ··· , xn) − 1. Therefore, we can rewrite the the likelihood function as ( 1, for max(x , ··· , x ) − 1 ≤ θ ≤ min(x , ··· , x ) L(θ) = 1 n 1 n 0, otherwise

Thus, we can select any value in the interval [max(x1, ··· , xn) − 1, min(x1, ··· , xn)] as the MLE for θ. Therefore, the MLE is not uniquely specified in this example.

3 Exercises

Exercise 1: Let X1, ··· ,Xn be an i.i.d. sample from a with parameter λ, i.e., λxe−λ P (X = x|λ) = . x! Please find the MLE of the parameter λ.

Exercise 2: Let X1, ··· ,Xn be an i.i.d. sample from an with the density function 1 − x f(x|β) = e β , with 0 ≤ x < ∞. β 7

Please find the MLE of the parameter β. Exercise 3: has a density function as 1 f(x|α, λ) = λαxα−1e−λx, with 0 ≤ x < ∞. Γ(α)

Suppose the parameter α is known, please find the MLE of λ based on an i.i.d. sample X1, ··· ,Xn.

Exercise 4: Suppose that X1, ··· ,Xn form a random sample from a distribution for which the pdf f(x|θ) is as follows: ( θxθ−1, for 0 < x < 1 f(x|θ) = 0, for x ≤ 0

Also suppose that the value of θ is unknown (θ > 0). Find the MLE of θ.

Exercise 5: Suppose that X1, ··· ,Xn form a random sample from a distribution for which the pdf f(x|θ) is as follows: 1 f(x|θ) = e−|x−θ| for − ∞ < x < ∞ 2 Also suppose that the value of θ is unknown (−∞ < θ < ∞). Find the MLE of θ.

Exercise 6: Suppose that X1, ··· ,Xn form a random sample from a distribution for which the pdf f(x|θ) is as follows: ( eθ−x, for x > θ f(x|θ) = 0, for x ≤ θ

Also suppose that the value of θ is unknown (−∞ < θ < ∞). a) Show that the MLE of θ does not exist. b) Determine another version of the pdf of this same distribution for which the MLE of θ will exist, and find this estimate.

Exercise 7: Suppose that X1, ··· ,Xn form a random sample from a uniform distribution on the interval (θ1, θ2), with the pdf as follows: ( 1 , for θ1 ≤ x ≤ θ2 f(x|θ) = θ2−θ1 0, otherwise

Also suppose that the values of θ1 and θ2 are unknown (−∞ < θ1 < θ2 < ∞). Find the MLE’s of θ1 and θ2.