O'Reilly logo

Data Analysis with R - Second Edition by Tony Fischetti

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, such as am (automatic or manual transmission) as well.

Normally, in a simple linear regression equation, ŷ = b0 + b1, x will hold the actual value of the predictor variable. In the case of a simple linear regression with a binary predictor (such as am),  x will hold a dummy variable instead. Specifically, when the predictor is automatic,  x will be 0, and when the predictor is manual,  x will be ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required