Checking linearity for a linear regression model? I've read that there are various assumptions associated with a multiple linear regression model which you should check/validate before getting too excited about your model results.
One of these is the assumption of linearity. I get that you would plot the dependent variable against the independent variable and visually check for linearity, but is there a more scientific way to do this?
I have the two plots below. Looking at the first, I can see some linearity by removing the outliers. The second however, is much harder. I can *maybe* see something, but I'm not sure if this is my eyes playing tricks on me.


If I determine the second plot does not satisfy linearity, what do I do? Exclude the feature from the model?
I like GAM (Generalised additive model) with regression splines:
# Load data
library(ISLR)
a = Auto

# Run GAM with splines
library(gam)
g = gam(mpg~s(displacement,5)+s(horsepower,5),data=a)
plot(g, se=T)


The result (plot) shows you that displacement can be well approximated by a linear function for lower values (&lt; 250 or so). However, there is a &quot;kink&quot; at about 250, so that overall, a linear approximation would not be very good here.
See ISL, Chapter 7 for more details. There are also Labs for Python and R where you can see code details.
Also see this example in R with simulated data for more details.
Alternatively, look at a Q–Q plot after regression, e.g. in R:
l = lm(mpg~s(displacement,5)+s(horsepower,5),data=a)
plot(l)