# Categorical or continuous variable?

Suppose that in a linear regression, some of the continuous variables (such as number of pills taken each day) have small discrete values. For e.g. the number of pills taken each day can take values 0,1,2,3.

Would it be better to treat these continuous variables as categorical or ordinal variables? What should be the appropriate approach?

Thanks.

• I wouldn't say that number of pills taken in a day is continuous. In fact, I would guess that it's Poisson distributed (count data, i.e. discrete), with the interval time between pills taken as continuous (exponential). – Eric Peterson Apr 24 '13 at 2:44
• "number of pills" isn't continuous, it's discrete, unless you can take 0.153847 of a pill. But that doesn't mean you should treat them as categorical or ordinal. – Glen_b Apr 24 '13 at 3:44
• Thanks for clarifying the continuous/discrete bit. The word continuous was a wrong usage in this context. – user22119 Apr 24 '13 at 12:51

For the independent variables: assuming you're looking at association, you can simply test whether it is necessary to treat the variable as categorical. If you compare a model: $$out = \beta_0 + \beta_1 I(x=1) + \beta_2 I(x=2) + \epsilon$$ (have as many dummies as you need for the variable at hand) it's straightforward to see that this model: $$out = \beta_0 + \beta_1 x + \epsilon$$ Is a submodel (just assume $\beta_2==2\beta_1$). This allows for a likelihood ratio test that will either indicate that you need the more complex model (categorical interpretation) or (given your sample size makes the power of the test trustworthy) warrant using the simpler numerical interpretation.