# Can a logistic regression have both continuous and discrete variables as covariates or as regressors?

My dependent variable should be binary, but can I include discrete and continuous variables simultaneously in my equation? For example let's say X1 is discrete and X2 is continuous?

• Yes, no problem.
– Momo
Aug 31, 2018 at 22:42
• Could you please elaborate as in how that would be possible? Sep 1, 2018 at 22:33
• Do you mean how it should be done when using statistics software? Or do you mean how to specify the equation? Or are you interested in the maths? In all cases it would help to know more about the variables, the software used and where you are not sure when including the regressors.
– Momo
Sep 1, 2018 at 23:01

## 1 Answer

There is absolutely no problem, just code your categorical predictor(s) as dummy variables, or some other form of . This can be used with all form of regression models. It is usually the type of the response ($$Y$$) variable which "dictates" the type of regression model that can be used, not the predictors.

So, for a binary response, logistic regression, for a multinomial response, multinomial logistic regression, continuous response, muliple linear regression, and so on (there are of course alternatives). But in these decisions the type of predictor variable generally plays little role. See for instance Model for continuous response and a mix of continuous and categorical predictors and Predicting with both continuous and categorical features

• What if there are more than 1000 rows and I have a column which has continuous variable (e.g. 67.22,77.89) this will create an awful lot of dummy variables extending my column size from the original 21 to 212.. Which approach should I take Jun 26, 2020 at 6:12
• @Harishreddy That warrants its own question. Briefly, you would treat it as a continuous variable, not as 1000 levels of a categorical variable.
– Dave
Aug 28, 2020 at 15:02