Q:

Logistic Regression using dummy variables in MATLAB

I have a model where categorical (mutually exclusive) variables predict bankruptcy. Chi-square is significant. How can I code a logistic regression model in MATLAB that proves that some of these variables explain the bankruptcies better.
There are 4 variables: which implies 3 dummy variables.
X = [  0 0 0
      0 1 0 
      0 0 0 
      0 0 1 
      0 0 1 
      1 0 0  
      1 0 0 ......... ] ;
Y = [1 0 0 1 1 0 0 .....]; % 1 means bankruptcy

I think I should use glmfit (from http://matlabdatamining.blogspot.com/2009/03/logistic-regression.html) but I wasn't sure if using dummy indicators would require any additional interpretation/inputs. I use latest version and have Statistics and Optimization Toolbox.

A:

You can use glmfit and create dummy variables yourself. If you include a constant term you would want to omit one of the dummy variables.
However, as of late 2013 there is a fitglm function that can handle categorical predictors for you.

