1
$\begingroup$

I am trying to use a combination of binary and continuous input variables in a linear regression. In my studies I used only continuous variables in linear regression. Should I do anything special now that I am including binary input variables?

Also, does this answer change depending on whether I am fitting to predict a continuous outcome vs a binary outcome?

$\endgroup$
2
  • $\begingroup$ the question is not clear to me, do you have binary inputs or binary as response variable? $\endgroup$
    – Haitao Du
    Jul 26, 2017 at 18:44
  • $\begingroup$ @hxd1011 I tried to clarify the question. Apologies for the confusion, I was very new to machine learning when I wrote this. $\endgroup$
    – Selah
    Sep 18, 2018 at 15:05

2 Answers 2

2
$\begingroup$

If you have reason to believe that the standard linear regression assumptions, $y = X\beta + \epsilon$, with $\epsilon$ being IID normal, and etc. Then it doesn't matter that your predictors are continuous or binary.

Binary outcomes should generally not be modeled with a linear regression. Instead try a logistic regression.

$\endgroup$
3
$\begingroup$

If Binary feature is (0,1) type, then that can be used directly in the linear regression model. If by Binary feature, you mean having two levels for example ("yes","no"), then you can map ("yes","no") to (0,1) or you can create dummy variable. We never create dummy variables for continuous features.

Ff you are making a prediction for continuous response variable then use the linear regression but if the response variable is binary then you should try logistic regression.

$\endgroup$
4
  • $\begingroup$ Does "response variable" mean the same thing as "outcome variable"? $\endgroup$
    – Selah
    Jul 27, 2017 at 17:26
  • $\begingroup$ @Selah yes they mean the same. $\endgroup$ Jul 27, 2017 at 18:28
  • $\begingroup$ do you mean create dummy variables from categorical variables? $\endgroup$
    – Selah
    Sep 18, 2018 at 15:07
  • $\begingroup$ Create dummy from categorical Variables( having more than two levels). Binary variable (0,1) type is same as dummy variable, so no need to create dummy variable for such variable. If you categorical feature has two levels for example ("yes","no"), then you can map that to (0,1) or can create dummy variable. $\endgroup$ Sep 18, 2018 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.