Simple linear regression with a binary predictor

One of the coolest things about linear regression is that we are not limited to using predictor variables that are continuous. For example, in the last section, we used the continuous variable wt (weight) to predict miles per gallon. But linear models are adaptable to using categorical variables, like am (automatic or manual transmission) as well.

Normally, in the simple linear regression equation Simple linear regression with a binary predictor, Simple linear regression with a binary predictor will hold the actual value of the predictor variable. In the case of a simple linear regression with ...

Get R: Data Analysis and Visualization now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.