1. Home
  2. Explore
  3. Statistics
  4. Introduction to Bayesian Inference

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Introduction to Bayesian Inference

Speaker 1Speaker 2

Introduction to Bayesian Inference

6:46
0:00-6:46
  1. Anna

    Welcome back. Today we’re introducing Bayesian inference: how we use Bayes’ theorem in practice to learn about the process that may have generated observed data. The key idea is to start with data and an assumed probability model, then update what we think about that model’s parameters.

  2. Michael

    Let’s begin with the theorem itself. If events A1 through AN are mutually exclusive and exhaustive, the probability of A1 given B is the probability of B given A1, multiplied by the probability of A1, and divided by the sum of that same numerator across all the possible events. That denominator accounts for all the ways B could have occurred.

  3. Anna

    Now translate that idea into statistical inference. We observe data, which we can call x, and assume it came from a probability model such as f of x given a parameter theta. We don’t know the true process, so we use the data to learn about its properties—starting with theta.

  4. Michael

    There can also be competing assumptions. For instance, one model might say the data came from f of x given theta, while another says it came from g of x given lambda. We estimate the parameters under each assumption, then compare how well the resulting models explain future or unseen data. The model that does better is considered closer to the underlying process.

  5. Anna

    Bayes’ theorem enters when we infer the parameter in a model. A frequentist approach often treats theta as a fixed, unknown point value. Bayesian inference instead represents uncertainty about theta with a probability distribution. That matters because a limited sample may be compatible with several parameter values, even if some are more plausible than others.

  6. Michael

    Exactly. Imagine the observed data makes theta equal to 0.6 seem most plausible, but theta equal to 0.5 could also have produced the data. Reporting only one point estimate can hide that uncertainty. A distribution lets us express which values are more likely and which are less likely, given what we have observed.

  7. Anna

    So the goal shifts from estimating just one true value of theta to estimating its distribution after seeing the data. We write that as the probability distribution of theta given x. It is conditional on the observations: different data could lead to a different distribution.

  8. Michael

    For a continuous parameter, Bayes’ theorem is written as the posterior density of theta given x equals the likelihood of the data given theta, multiplied by the prior density of theta, divided by the marginal likelihood of the data. In symbols, that’s p of theta given x equals p of x given theta times p of theta, divided by p of x.

  9. Anna

    Let’s unpack the first term. The likelihood, p of x given theta, tells us how compatible the observed data is with each possible value of theta under our assumed model. The data x is held fixed, and we evaluate the model for different theta values. That gives a likelihood function—not a probability distribution over theta.

  10. Michael

    That distinction is important. The model describes probabilities or densities for possible data, but the likelihood asks how well different parameter values account for the data we actually observed. A common notation makes this clearer: likelihood of theta given x. It is the same quantity, viewed as a function of theta.

  11. Anna

    The second term, p of theta, is the prior distribution. It represents our assumptions or information about theta before seeing this particular data. A prior might come from the context of the experiment or from previous studies. For example, in a word-recognition task, we might expect the probability of a correct response to be somewhere between 0.6 and 1, depending on the situation.

  12. Michael

    Then the denominator, p of x, is called the marginal likelihood, or evidence. For a continuous theta, it is found by integrating the likelihood times the prior over all possible theta values. This is the continuous version of adding up the numerator across all the possibilities in the basic theorem.

  13. Anna

    The marginal likelihood is a number for the observed data, rather than a curve over theta. Its crucial role is normalization: dividing by it makes the posterior a proper probability distribution, with total area equal to one. You can think of it as the overall probability density of the observed data after accounting for the possible parameter values.

  14. Michael

    That gives us the central relationship: posterior equals likelihood times prior, divided by marginal likelihood. The posterior tells us which parameter values are more or less plausible after combining the data with our prior assumptions.

  15. Anna

    In practice, the first step is to make a likelihood assumption: specify the probability model you think could have generated the data. For example, you might assume observations come from a normal distribution with mean mu and standard deviation sigma. The model choice determines how you calculate the likelihood.

  16. Michael

    The second step is to make prior assumptions for the parameters. In that normal example, you need priors for both mu and sigma. You might assign mu a normal prior and give sigma a prior that only allows positive values, such as a truncated normal. The particular choices should reflect the context and the assumptions you want to make.

  17. Anna

    Third, collect or identify the observed data. Then calculate the likelihood for different parameter values and combine it with the prior densities. With mu and sigma, that means considering their possible values together and forming a posterior distribution conditional on the observed data.

  18. Michael

    Finally, divide by the marginal likelihood to normalize the result. If you leave that constant out, the product of likelihood and prior is an unnormalized posterior: it preserves the relative support for different parameter values, but its total area is not one.

  19. Anna

    So the practical recipe is: specify a generative model, choose priors for its parameters, observe data, and update the priors with the likelihood to obtain a posterior. The posterior retains uncertainty instead of forcing us to pretend that a limited sample identifies one parameter value with certainty.

  20. Michael

    And that posterior is the foundation for the broader inference workflow. We can use it to understand plausible parameter values, then assess competing generative assumptions by how well they explain unseen or future data. This lecture has laid out the concepts; the next step is implementing the calculations in R and building Bayesian models step by step.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent