Unit 5, lesson 35

Likelihood and Maximum Likelihood Estimation

How a statistical model turns fixed data into a likelihood function of the parameter, how likelihood ratios compare parameter values, and how the maximum likelihood estimate, the log-likelihood and boundary estimates work.

  • Video 35
  • Estimators and Likelihood

Eight independent trials of the same process give six successes and two failures. Is a success probability of 0.50.5 or of 0.750.75 better supported by these results? Likelihood answers questions of this kind by holding the observed data fixed and asking how probable they are under each value of the parameter. This lesson builds the likelihood from a stated model, compares parameter values through likelihood ratios, finds the value with the largest likelihood and explains why that value is an estimate rather than a certainty.

Key terms

Statistical model

Definition A statistical model is a stated family of probability distributions for the data, one distribution for each value of a parameter θ\theta in a stated parameter space Θ\Theta. For discrete data each distribution gives the probability of every possible data set, and for continuous data it gives a joint probability density. The model includes its assumptions about how the observations relate to one another, for example that they are independent. In the running example the model says that the eight trials X1,…,X8X_1, \dots, X_8 are independent and that each one is Bernoulli⁡(p)\operatorname{Bernoulli}(p), with Xi=1X_i = 1 for a success and Xi=0X_i = 0 for a failure. The parameter space is 0≤p≤10 \le p \le 1. Under this model the probabilities of the eight outcomes multiply, so a particular sequence with kk successes and 8−k8 - k failures has probability pk(1−p)8−kp^{k}(1 - p)^{8 - k}.

In plain words The model says how the data would behave if the parameter had a given value. It is an assumption made before the analysis, and the data can cast doubt on it but cannot prove it. Independence does real work in that product. If a success made the next trial more likely to succeed, the probability of a sequence would need factors that depend on the earlier outcomes, even though every recorded value would still be 00 or 11.

Example At p=0.5p = 0.5 every one of the 28=2562^8 = 256 possible sequences of eight outcomes has probability 0.58=1/2560.5^8 = 1/256. At p=0.75p = 0.75 the sequences are no longer equally likely, and a sequence with six successes has probability 0.756⋅0.252=729/65536≈0.01110.75^6 \cdot 0.25^2 = 729/65536 \approx 0.0111, while the sequence of eight failures has probability 0.258≈0.00001530.25^8 \approx 0.0000153.

Likelihood function

Definition Fix the observed data and a statistical model with parameter θ\theta in Θ\Theta. The likelihood function assigns to each θ\theta in Θ\Theta the probability of the observed data when the parameter equals θ\theta,

L(θ)=Pθ(observed data),L(\theta) = P_{\theta}(\text{observed data}) ,

or, for continuous data, the joint density evaluated at the observed values. The data are held fixed and θ\theta varies. When the model makes discrete observations X1,…,XnX_1, \dots, X_n independent and their observed values are x1,…,xnx_1, \dots, x_n, the joint probability is a product,

L(θ)=∏i=1nPθ(Xi=xi),L(\theta) = \prod_{i=1}^{n} P_{\theta}(X_i = x_i) ,

and for independent continuous observations the individual densities are multiplied in the same way. Multiplying a likelihood by a positive constant that does not depend on θ\theta gives an equivalent likelihood, with the same ratios between parameter values and the same maximizing values.

In plain words A probability holds the parameter fixed and asks which data might occur. Likelihood runs the other way. It holds the data that did occur fixed and compares parameter values. Its values come from probabilities or densities of data, so it is not a probability distribution for the parameter, and its values over all parameter values need not add or integrate to 11.

Example The observed sequence has six successes and two failures. Each success contributes a factor pp and each failure a factor 1−p1 - p, so for 0≤p≤10 \le p \le 1

L(p)=p6(1−p)2.L(p) = p^{6}(1 - p)^{2} .

If the model treats only the total number of successes as the data, the binomial probability includes the number of sequences with six successes, (86)=28\binom{8}{6} = 28, and the likelihood becomes 28p6(1−p)228p^6(1 - p)^2. The area under p6(1−p)2p^6(1 - p)^2 from p=0p = 0 to p=1p = 1 is 1/2521/252, and the area under the count version is 28/252=1/928/252 = 1/9. Neither curve is a probability density for pp.

Likelihood ratio

Definition For two parameter values θ1\theta_1 and θ0\theta_0 in Θ\Theta with L(θ0)>0L(\theta_0) > 0, the likelihood ratio of θ1\theta_1 to θ0\theta_0 is

L(θ1)L(θ0).\frac{L(\theta_1)}{L(\theta_0)} .

For discrete data it says how many times as probable the observed data are under θ1\theta_1 as under θ0\theta_0, and for continuous data it compares the densities at the observed values. A ratio above 11 favors θ1\theta_1, a ratio below 11 favors θ0\theta_0, and a ratio of exactly 11 means the data do not distinguish the two values. Any positive factor that does not depend on the parameter cancels from the ratio.

In plain words The ratio measures how strongly these data, under this model, support one parameter value relative to another. It is not the odds that θ1\theta_1 rather than θ0\theta_0 is the true value. Odds for parameter values need an extra ingredient, prior probabilities for those values. When a prior gives positive probability to both values, Bayes’ theorem says that the posterior odds equal the prior odds multiplied by the likelihood ratio.

Example Compare p=0.75p = 0.75 with p=0.5p = 0.5 for the observed sequence.

L(0.75)L(0.5)=0.756⋅0.2520.58=729256≈2.85\begin{aligned} \frac{L(0.75)}{L(0.5)} &= \frac{0.75^{6} \cdot 0.25^{2}}{0.5^{8}} \\[0.4em] &= \frac{729}{256} \approx 2.85 \end{aligned}

The observed sequence is about 2.852.85 times as probable when p=0.75p = 0.75 as when p=0.5p = 0.5. The count likelihood multiplies both values by 2828, giving 28⋅729/65536≈0.31128 \cdot 729/65536 \approx 0.311 and 28/256=0.10937528/256 = 0.109375, and the ratio is still 729/256729/256.

Maximum likelihood estimate

Definition A maximum likelihood estimate (MLE) is a parameter value θ^\hat{\theta} in Θ\Theta with L(θ^)≥L(θ)L(\hat{\theta}) \ge L(\theta) for every θ\theta in Θ\Theta. An MLE need not exist, and when one exists it need not be unique. For kk successes in n≥1n \ge 1 independent Bernoulli trials with parameter space 0≤p≤10 \le p \le 1, the likelihood is pk(1−p)n−kp^k(1 - p)^{n - k}, with 000^0 read as 11, and it has exactly one maximizer, the sample proportion

p^=kn.\hat{p} = \frac{k}{n} .

This includes k=0k = 0 and k=nk = n, where the maximum sits at an end of the parameter space.

In plain words A maximum likelihood estimate is an allowed parameter value under which the observed data are most probable, or have the highest density. Raising pp makes each observed success more probable and each observed failure less probable, and when the data contain both kinds of outcome the peak sits where the two pulls balance. The MLE is an estimate computed from one sample. Another sample could give a different value, and the number alone does not report how far it may be from the true parameter.

Example For six successes in eight trials a few values of the likelihood are below.

pp0.70.70.750.750.80.8
L(p)L(p)0.010590.010590.011120.011120.010490.01049

A fine grid over 0≤p≤10 \le p \le 1 puts the peak at p^=6/8=0.75\hat{p} = 6/8 = 0.75, in agreement with the formula. For an MLE that is not unique, suppose the parameter space contains only the two values 0.30.3 and 0.70.7, and two trials give one success and one failure. Both values have likelihood 0.3⋅0.7=0.210.3 \cdot 0.7 = 0.21, so both are maximum likelihood estimates.

Log-likelihood

Definition The natural logarithm ln⁡y\ln y of a positive number yy is the exponent uu with eu=ye^u = y. It is strictly increasing, and it turns products into sums, since ln⁡(ab)=ln⁡a+ln⁡b\ln(ab) = \ln a + \ln b for positive aa and bb. Where the likelihood is positive, the log-likelihood is

ℓ(θ)=ln⁡L(θ).\ell(\theta) = \ln L(\theta) .

For independent observations it is the sum of the logarithms of the individual probabilities or densities. Because the logarithm is strictly increasing, ℓ(θ1)>ℓ(θ0)\ell(\theta_1) > \ell(\theta_0) exactly when L(θ1)>L(θ0)L(\theta_1) > L(\theta_0). So if the likelihood is positive somewhere, maximizing ℓ\ell over the values with positive likelihood gives exactly the maximizers of LL. A constant factor c>0c > 0 in the likelihood becomes an added constant ln⁡c\ln c, and a difference of log-likelihoods is the logarithm of a likelihood ratio.

In plain words Sums are easier to work with than long products, by hand and on a computer. A product of many probabilities can be too small for a computer to store. The product of 20002000 factors of 0.50.5 is less than 10−60210^{-602}, far below the smallest positive number that ordinary double-precision arithmetic can represent, so the computed product comes out as 00. Its logarithm, −2000ln⁡2≈−1386.29-2000 \ln 2 \approx -1386.29, is an ordinary number. Taking logarithms does not turn the likelihood into a probability. For discrete data the log-likelihood is never positive, because probabilities are at most 11, while densities can exceed 11.

Example For six successes and two failures, on 0<p<10 < p < 1,

ℓ(p)=6ln⁡p+2ln⁡(1−p).\ell(p) = 6 \ln p + 2 \ln(1 - p) .

The values are ℓ(0.75)≈−4.4987\ell(0.75) \approx -4.4987 and ℓ(0.5)=−8ln⁡2≈−5.5452\ell(0.5) = -8 \ln 2 \approx -5.5452. Their difference, about 1.04651.0465, equals ln⁡(729/256)\ln(729/256), the logarithm of the likelihood ratio. For readers who know derivatives, the derivative 6/p−2/(1−p)6/p - 2/(1 - p) is positive for p<3/4p < 3/4, zero at p=3/4p = 3/4 and negative for p>3/4p > 3/4, which confirms the peak found on the grid.

Boundary estimate

Definition A maximum likelihood estimate is a boundary estimate when it lies on the edge of the parameter space rather than strictly inside it. With k=0k = 0 successes in n≥1n \ge 1 trials and parameter space 0≤p≤10 \le p \le 1, the likelihood (1−p)n(1 - p)^n decreases as pp increases, so the MLE is the boundary value p^=0\hat{p} = 0. Whether an MLE exists here depends on the declared parameter space. If the model allows only 0<p<10 < p < 1, the likelihood rises toward 11 as pp approaches 00 but never reaches it, and no maximum likelihood estimate exists.

In plain words An estimate on the edge says which allowed value fits these particular data best. It does not establish that the edge value is the truth. A run of failures is quite probable when the success probability is small but positive, so an estimate of 00 does not show that success is impossible. Shortcuts that assume a peak strictly inside the parameter space can also mislead here. The standard error formula p^(1−p^)/n\sqrt{\hat{p}(1 - \hat{p})/n} gives 00 at p^=0\hat{p} = 0, which understates the uncertainty.

Example Suppose all eight trials fail. Then L(p)=(1−p)8L(p) = (1 - p)^8, which equals 11 at p=0p = 0. At p=0.1p = 0.1 the probability of eight failures is 0.98≈0.43050.9^8 \approx 0.4305, and at p=0.2p = 0.2 it is 0.88≈0.16780.8^8 \approx 0.1678. The likelihood ratio of p=0p = 0 to p=0.1p = 0.1 is only about 2.322.32, so these data favor p=0p = 0 over p=0.1p = 0.1 only mildly.

Check yourself

  1. Five independent Bernoulli trials give success, failure, success, success, failure. Write the likelihood, find the maximum likelihood estimate of pp and compute the likelihood ratio of p=0.6p = 0.6 to p=0.4p = 0.4.
Show the answer

There are three successes and two failures, so L(p)=p3(1−p)2L(p) = p^3(1 - p)^2 for 0≤p≤10 \le p \le 1, and the MLE is p^=3/5=0.6\hat{p} = 3/5 = 0.6. The two likelihood values are L(0.6)=0.216⋅0.16=0.03456L(0.6) = 0.216 \cdot 0.16 = 0.03456 and L(0.4)=0.064⋅0.36=0.02304L(0.4) = 0.064 \cdot 0.36 = 0.02304, so the ratio is 0.03456/0.02304=1.50.03456/0.02304 = 1.5. Modeling only the count of successes multiplies both values by (53)=10\binom{5}{3} = 10 and leaves the ratio at 1.51.5.

  1. Eight independent trials all fail. Find the maximum likelihood estimate of pp when the parameter space is 0≤p≤10 \le p \le 1. Does the estimate show that a success can never happen? What changes if the model allows only 0<p<10 < p < 1?
Show the answer

The likelihood is L(p)=(1−p)8L(p) = (1 - p)^8, which is largest at p=0p = 0, so p^=0\hat{p} = 0, a boundary estimate. It does not show that success is impossible. If p=0.1p = 0.1, eight failures in a row still have probability 0.98≈0.430.9^8 \approx 0.43, so data like these are common when successes are merely uncommon. The estimate is the best-supported allowed value for this one sample, and its uncertainty has to be assessed separately. If the parameter space is 0<p<10 < p < 1, the likelihood approaches 11 as pp approaches 00 without reaching it, so no maximum likelihood estimate exists.

  1. For six successes in eight trials, a colleague says that the likelihood ratio of 2.852.85 proves that p=0.75p = 0.75 is almost three times as probable as p=0.5p = 0.5. The colleague also expects the estimate to move if the binomial factor 2828 is included. Correct both claims.
Show the answer

The ratio compares the probability of the observed data under two parameter values. It assigns no probabilities to the parameter values themselves, and a statement about those needs a prior. For example, if before the data a prior gave probability 12\tfrac12 to each of exactly these two values, the posterior odds would be 1⋅729/256≈2.851 \cdot 729/256 \approx 2.85, and the posterior probability of p=0.75p = 0.75 would be 729/985≈0.740729/985 \approx 0.740. A different prior would give different odds. The factor 2828 is positive and does not depend on pp, so it multiplies the likelihood at every pp by the same amount. The maximizer stays at 0.750.75 and the ratio stays at 729/256729/256.

How this lesson connects