1
$\begingroup$

I am attempting to do logistic regression on a data set of patients. The dependent variable is disease status (binary, yes or no). There are multiple independent variables some binary such as susceptibility gene (y/n) and others continuous such as patient age.

When I have looked up logistic regression, in all the books I have read the examples given always have all the independent variables being continuous. Therefore is it mathematically valid for me to do logistic regression on my data set with continuous and binary random variables? Or is there an alternative regression model I should use?

$\endgroup$
2
$\begingroup$

Yes you can have indicator variables (aka dummy variables) included in your independent variables. Just be sure to leave one group out of the regression to avoid collinearity. Eg for your susceptibility gene you can use either the "yes" group or the "no" group as an independent variable, but not both in the same regression.

Some stats packages will automatically create a reference group that is left out of the regression if given an indicator variable.

$\endgroup$
  • $\begingroup$ Thanks for the answer, given that multiple binary indicators (dummies) gene (y/n) risk A exposure(y/n) risk B exposure (y/n) to avoid collinearity I do the regression separately on all variations i.e. the six possible combinations of (y/n,y/n,y/n)? $\endgroup$ – Spinorial Jun 25 '14 at 14:29
  • $\begingroup$ No. The binary variable is a factor variable with 2 values. So, normally with one-hot-encoding instead of binary variable risk.exposure.A, you would have 2 columns: risk.exposure.A.y and risk.exposure.A.n. But, because risk.exposure.A.y + risk.exposure.A.n = 1 (because of the encoding), which would be identical (and also collinear with interceptor column), you need to NOT use one variable. So, you would use from encoding only 1 of 2 variables, for example only risk.exposure.A.y. Build a model only with risk.exposure.A.y, risk.exposure.B.y, other numeric variables ~ dependent variable. $\endgroup$ – rapaio Jun 26 '14 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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