What makes a model linear

Introduction to Linear Modeling in Python

Jason Vestuto

Data Scientist

Taylor Series

Things to know:

  1. approximate any curve
  2. polynomial form: y = a0 + a1*x + a2*x**2 + a3*x**3 + .... + an*x**n
  3. often, first order is enough: y = a0 + a1*x
Introduction to Linear Modeling in Python

Series Terms: a0=1

Plot of a constant y=1 line with slope zero

Introduction to Linear Modeling in Python

Series Terms: a1=1

Plot of line with nonzero slope y = 1*x

Introduction to Linear Modeling in Python

Series Terms: a2=1

Plot of quadratic line y = x^2, half a parabola, up turned

Introduction to Linear Modeling in Python

Combining all Terms

Plot of 4 curves, y=1 in red, y=x in green, y=x^2 in blue, and the sum of those three, in black

Introduction to Linear Modeling in Python

Real Data

Scatter plot of sea level change versus time in years

Introduction to Linear Modeling in Python

Zeroth Order

Scatter plot of data, sea level versus time, and line plot of model y=6.5, the mean of the data

Introduction to Linear Modeling in Python

First Order

Scatter plot of data, sea level versus time, and line plot of model y=5 + 0.08*x, with the model line passing through most data points

Introduction to Linear Modeling in Python

Higher Order

Scatter plot of data, sea level versus time, and line plot of model y=5 + 0.08*x + 0.0025*x^2, with the model line fitting data points

Introduction to Linear Modeling in Python

Over-fitting

Scatter plot of data sea level versus time, twice as far in time, with 2 models, line plot y=6.5 + 0.08x fitting data well, and line plot of model y=5 + 0.08*x + 0.0025*x^2, deviating strongly at later times

Introduction to Linear Modeling in Python

Let's practice!

Introduction to Linear Modeling in Python

Preparing Video For Download...