Get startedGet started for free

Non-Bayesian Linear Regression

1. Welcome!

Hello! My name is Jake Thompson. I'm a psychometrician at the University of Kansas, and I'll be your instructor in this course. For this course I'm assuming that you are already familiar with linear regression and know the basics of Bayesian analysis.

2. Overview

Throughout this course we'll learn how to estimate a Bayesian model, customize a model, evaluate a model and its predictive power, and finally how to present and use a Bayesian regression model.

3. A review of frequentist regression

Before we get into the Bayesian methods, we'll first review linear regression using non-Bayesian, or frequentist, methods. This will provide helpful comparisons between the inferences we can make when using frequentist and Bayesian methods. For examples, I'll be using the kidiq data from the rstanarm package, a package for Bayesian applied regression modeling which you'll be introduced to in the next video and use throughout this course. This dataset includes scores of kids on an IQ test, along with the mother's IQ, age, and whether or not she finished high school.

4. A review of frequentist regression

We can estimate a frequentist linear regression by using the lm function. For example, we can predict a child's score from the mother's IQ. We can then look at a summary of the model. This output should look familiar. We have information about the model's residuals, coefficient estimates, and information about how our model is performing.

5. Examing model coefficients

If we only want information about the coefficients, we can use the tidy function from the broom package. This shows the estimate, standard error, test statistic and p-value for each coefficient in the model. Using a p-value cutoff of 0.05, we see that the mom's IQ is a significant predictor of the child's score on the IQ test. However, recall what the p-value really tells us. This only tells us the probability of observing data that give rise to a test statistic this large if the true value of the parameter were zero. This is the key problem with frequentist regression.

6. Comparing Frequentist and Bayesian probabilities

To illustrate, let's calculate the probability of a woman having cancer, given a positive mammogram. We know that if a woman has cancer, they will have a positive mammogram 90% of the time. This is like the p-value, the probability of our data, given a null hypothesis. We also know that in the United States, 0.4% of women have breast cancer. This what we will later call our prior, or our belief about the parameter before looking at the data. From this we can calculate that the probability of a random woman getting a positive mammogram is 10%. So, given a positive mammogram, what are the chances that the woman has cancer? Only 3.6%! This is very different from the 90%, and illustrates the importance of making inferences about the parameter we are interested in (the probability of cancer), rather than the data (the probability of a positive mammogram). In this course, we'll apply these Bayesian methods to regression to make better inferences about model parameters.

7. Spotify data

For the exercises throughout this course, we'll be using data on Adele, Beyoncé, and Taylor Swift songs from the Spotify API. This data includes the name and artist of each song, the age of the song in days, the valence, or how positive or negative the song sounds, the tempo, or speed, of the song, the popularity according to Spotify, and the length of the song. Throughout this course, we'll predict the popularity from the other variables.

8. Let's practice!

Let's start with a frequentist regression.

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.