page_title: Likelihood function
section_title: Example
hierarchical_section_title: Likelihood function / Definition / Discrete probability distribution / Example
caption_attribution_description: Estimating the probability of a coin landing heads-up after observing HH without a priori knowledge
context_page_description: In statistics, the likelihood function measures the goodness of fit of a statistical model to a sample of data for given values of the unknown parameters. It is formed from the joint probability distribution of the sample, but viewed and used as a function of the parameters only, thus treating the random variables as fixed at the observed values.
  The likelihood function describes a hypersurface whose peak, if it exists, represents the combination of model parameter values that maximize the probability of drawing the sample obtained. The procedure for obtaining these arguments of the maximum of the likelihood function is known as maximum likelihood estimation, which for computational convenience is usually done using the natural logarithm of the likelihood, known as the log-likelihood function. Additionally, the shape and curvature of the likelihood surface represent information about the stability of the estimates, which is why the likelihood function is often plotted as part of a statistical analysis.
  The case for using likelihood was first made by R. A. Fisher, who believed it to be a self-contained framework for statistical modelling and inference.
context_section_description: Consider a simple statistical model of a coin flip: a single parameter  that expresses the "fairness" of the coin. The parameter is the probability that a coin lands heads up ("H") when tossed.  can take on any value within the range 0.0 to 1.0. For a perfectly fair coin, .
  Imagine flipping a fair coin twice, and observing the following data: two heads in two tosses ("HH"). Assuming that each successive coin flip is i.i.d., then the probability of observing HH is
  Hence, given the observed data HH, the likelihood that the model parameter  equals 0.5 is 0.25. Mathematically, this is written as
  This is not the same as saying that the probability that , given the observation HH, is 0.25.  (For that, we could apply Bayes' theorem, which implies that the posterior probability is proportional to the likelihood times the prior probability.)
  Suppose that the coin is not a fair coin, but instead it has . Then the probability of getting two heads is
  Hence
  More generally, for each value of , we can calculate the corresponding likelihood. The result of such calculations is displayed in Figure 1.
  In Figure 1, the integral of the likelihood over the interval [0, 1] is 1/3. That illustrates an important aspect of likelihoods: likelihoods do not have to integrate (or sum) to 1, unlike probabilities.
caption: Figure 1.  The likelihood function (
    
      
        
          
            p
            
              H
            
            
              2
            
          
        
      
      {\displaystyle p_{\text{H}}^{2}}
    
  ) for the probability of a coin landing heads-up (without prior knowledge of the coin's fairness), given that we have observed HH.
exif: {}