Lecture 12 – Simple Linear Regression

by Suraj Rampure

Notebook credits:

Correlation

First, let's come up with some examples of data to use in slides. (Normally this wouldn't be put in the notebook, but it might be of interest to you.)

Also, note here we use np.corrcoef here to compute the correlation coefficients, because we haven't yet defined what r is manually.

Simple Linear Regression

First, let's implement the tools we'll need for regression.

Let's read in our data.

An interesting issue is that both our parent and child columns occur at fixed positions. We need to add some random noise, otherwise we'll suffer from gross overplotting.