(lecture_03)=
:::{post} Jan 7, 2024 :tags: statistical rethinking, bayesian inference, linear regression :category: intermediate :author: Dustin Stansbury :::
This notebook is part of the PyMC port of the Statistical Rethinking 2023 lecture series by Richard McElreath.
💡 Variables do not need to be Normally-distributed in order estimate the correct mean and variance using a Gaussian error model.
How does height influence weight?
i.e. "Weight is some function of height"
Options
"Weight $W$ is a function of height, $H$ and some unobserved stuff, $U$"
We need a function that maps adult weight as a proportion of height plus some unobserved/unaccounted-for causes. Enter Linear Regression:
Estimate how the average weight changes with a change in height:
The only estimator in Bayesian data analysis
$p(\alpha, \beta, \sigma)$ -- Posterior: Probability of a specific line (model)
$p(W_i | \alpha, \beta, \sigma)$ -- Likelihood: The number of ways the generative proces (line) could have produced the data
$p(\alpha, \beta, \sigma)$ -- Prior: the previous Posterior (sometimes with no data)
$Z$ -- normalizing constant
Common parameterization
$W$ is distributed normally with mean $\mu$ that is a linear function of $H$
For the following grid approximation simulation, we'll use a utility function utils.simulate_2_parameter_bayesian_learning_grid_approximation for simulating general Bayesian posterior update simulation. For the API, see utils.py
simulate_2_parameter_bayesian_learningquap vs MCMC implementationsMcElreath uses Quadratic Approximation--quap--for the first half of the lectures, which can speed up model fitting for continuous models that have posteriors that can be approximated with a multi-dimensional Normal distribution. However, we'll just use PyMC MCMC implementations for all examples without loss of generality. For the earlier examples in the lecture series where quap is being used, MCMC samples perfectly fast anyways.
Below we show:
Instead...Push out posterior predictions
Below, we again show:
:::{include} ../page_footer.md :::