# Regressing a discrete variable

I have a discrete dependent variable (say, number of units bought) and want to run a linear regression with in-store promotion, seasonality, trend etc. as predictor variables. I'm not sure if it is feasible to run a regression on a discrete variable. Till now I have been using a continuous variable as the dependent variable in regression. If valid, what are the nuances and caveats I need to be aware of?

• Lots of threads here on Poisson and other kinds of count regression. I'm deleting the "normal distribution" tag. It won't help anyone interested in this thread. – Nick Cox Feb 25 '15 at 13:35

## 1 Answer

One of the tags supplied to your question says it all: generalized-linear-model. There are several options here. Since your response is a positive count, a Poisson regression might work. The negative binomial is another option. In most software, these models are set up to look like basic linear regression -- you supply predictors to the response in the usual way -- and up to a point, the models have a similar interpretation. Under the hood, the math is different. Regression diagnostics can also be tricky.

If your count variable takes on a large number of discrete values, you can probably treat it as continuous. A log transformation might produce better looking residuals. Or not. It's worth trying some transformations to see if you get a better fit.

If you do venture into the realm of generalized linear models, I would suggest first reading an introductory text on the subject. Hardin's book is nice, but oriented towards using Stata. McCullagh and Nelder is the classic text, but the math is advanced and the cost is high.

RE: nuances and caveats. Plotting residuals seldom produces illuminating results. Fitting the models involves an iterative optimization routine ... so check that your solution converged properly. p-values from likelihood ratio tests are based on asymptotic chi-squared tests. So while these models look like linear regression models, the results are never quite as trustworthy. Check the model against a holdout set.

• In general, when trying to design an analysis, do you always need to specify the distribution of the variables? – Addem Jul 14 at 3:55