How to Include an Independent Variable with one-half 0s, one-half non-0 values

I am running a negative binomial regression. One of my independent variables is a measure of distance traveled - half of the observations are 0 because they do not travel, while the other half have a non-zero, positive value equal to the distance they travel.

What is the best way to include such a variable in a regression? I suspect that having 50% 0s in the independent variable makes it difficult if not wrong to interpret the coefficient if the variable is included as is. On the other hand, a simple dummy variable could fix the problem, but then measuring the effect of each unit of distance traveled would not be possible.

Is separating the observations into a 0 and non-0 group a legitimate solution? Such that the same regression is applied in both cases, except the non-0 group is applied the distance traveled variable which now would have no 0s.

I am especially concerned because the variable is still significant (p<0.05) besides this less-than-convincing negative, linear relationship. There appear to be 11 of 550 (2%) observations that are outliers (those above DIST of 8). Common sense is telling me to throw this variable out - is having 11 outliers like this acceptable?

• A 0 could be thought of as a missing value - but again, this would eliminate half of the observations for the regression. – WC4J Dec 1 '15 at 0:23
• Besides the other problems that were mentioned in answer or comments, because y is also discrete you have a lot of overplotting at x=0 there. You can't see where the mean x is. You should either mark in the mean or jitter the values (at least in the y-direction, possibly also a little in the x-direction). [It still won't solve the problem that if you plot the raw data you're only looking at the marginal relationship rather than the conditional one.] – Glen_b Dec 1 '15 at 2:21
• I've been meaning to learn how to jitter - especially useful for count data with few y values. Still a long way to go learning R. – WC4J Dec 1 '15 at 2:25
• try plot(jitter(y)~x) for starters. Then see the help on jitter for more control. – Glen_b Dec 1 '15 at 5:21

It's not necessarily wrong to include the variable as is.

If you expect the relationship to be linear so that the effect of travelling 2 above the effect of travelling 0 is twice the effect of travelling 1 above the effect of travelling 0, then everything is fine.

However, if you want to consider the possibility that the 0-cases behave differently from an otherwise linear relationship, then put an indicator variable ("dummy") in for the zeros (or the non-zeros, it makes no difference to the fit, only the interpretation of the indicator) and also leave the travel variable in the model as-is.

Here's an illustration of the two possible expectations about the behavior I am discussing -- you'll have to imagine it as being conditional on any other predictor variables (independent variables):

• Thank you for this very insightful answer. My scatter plot is, unfortunately, not as convincing. I have 11 points (out of 550 observations) that are outside the negative, linear relationship (outliers). However, I am surprised the significance of the distance variable is still relatively strong (p<0.05). Based on the scatter plot, given that there are 11 (2%) observations that are outliers, why would this variable still be significant? Is 2% simply an acceptable amount? I understand this may be an impossible question to answer without more info. Again, thanks for your help, regardless. – WC4J Dec 1 '15 at 1:54
• You have more predictors than this one, correct? – Glen_b Dec 1 '15 at 1:56
• Yes, I have five predictors - perhaps the y of these outliers are better explained by another predictor, so the fact that they are outliers here is not relevant with respect to the overall model specification. I am lacking in theory of statistics, please accept my apology. I added the scatter plot above. Thanks again. – WC4J Dec 1 '15 at 2:01
• In my answer, I made it clear my plot relates to what you expect about the conditional relationship (i.e. what you understand about the relationship between variables holding other variables constant), but you're looking at the marginal relationship in the data. You can't just plot y vs x and expect to see anything much of value, and if you do, you're using the data to generate a model, so if you use all the data to do that you'll impact your analysis (it affects the distribution of your estimates, standard errors and p-values). If you do it anyway, check (e.g. deviance) residuals vs x. – Glen_b Dec 1 '15 at 2:11
• BTW, sorry - for my plot I was influenced by the regression tag instead of thinking about the mention of the count response; nevertheless the underlying idea (but adapted to your particular link function and the discrete nature of the response) still holds – Glen_b Dec 1 '15 at 2:16