# The variable, the dummy and the interaction

Suppose you are studying crime and punishment. You have a data set in which people commit crimes (apples stolen from a bushel) and receive punishment (slaps on the wrist). Ho hum.

Now here is what makes the data interesting: imperfect monitoring. There was a guy who was supposed to protect the apples, only he wasn't always around. In the data you see instances in which a thief steals a dozen from the bushel scote-free, and instances in which a thief steals just one apple but suffers a beating. You might ask yourself: how much did monitoring influence punishment?

To thief i let p_i be the punishment, a_i the apples stolen and m the yes-no monitoring dummy.

$$y_i = \beta_0 + \beta_1 x_i + \varepsilon$$

how could you include m to test the hypothesis that punishment is doled based on whether the thief was monitored, independent of how many apples he stole?

Edit

Assume monitoring is random.

• There seems to be no overlap between your variables & your model. Does the thief know when the apples are being monitored? Is your null hypothesis that punishment is applied independent of whether any apples are stolen? Commented Oct 23, 2015 at 1:19
• @gung Good point. Monitoring is random - the thief can't best-respond to when he thinks the watchman will patrol. Clear now? Commented Oct 23, 2015 at 1:21

I appreciate a good story, and yours is definitely well told - the biblical undertones are everywhere, from the apples to the punishment. Gee... Is this out of Genesis? Or should we picture Siberian landscapes?

It's clear that there is a certain mistrust of government in the story line, but we want to resort to numbers to make it unquestionable. The apples stand for justice: more apples stolen, more punishment - these are rules we can all follow. On the other hand, policing is suspect in that it may amount to no demonstrable effect and is perceived as random. Am I right so far? If I'm off, just remember that I started off by complimenting your prose.

My suggestion would be to think about a logistic regression: The dependent variable is binary ($0$ = no punishment; $1$ = punishment), and on the independent side you have the dummy-coded variable for the policeman presence ($1$) or absence ($0$) from his duties, as well as a continuous variable: the number of apples stolen.

So the odds of being punished could possibly be predicted by the equation:

$Odds_{punishment} = e^{(\beta_o\, + \,\alpha\, * \,watchman + \beta_1\, * \,apples \,+\, \varepsilon)}\small \tag 1$.

What we want to see is whether or not the dichotomous variable watchman is capable of shifting the intercept in the linear equation in the exponent of the equation (1). If your suspicion proves unfounded and the policing is effective, the regression line will be shifted upwards by the presence of the guardian: it will be $\beta_o \,+\,\alpha$ as opposed to just $beta_o$. Hopefully the presence of a watchman will not bring the intercept down, which would imply a role as an enabler of crime... more of a post-modern story line.

And the last part to consider is whether the presence of the watchman changes the relationship between the number of apples stolen and the odds of punishment... perhaps when the guardian is present the odds increase much faster as the thief lingers on stealing more and more apples. On the other hand, if there is nobody watching, the thief can stole as many apples as he wants, and the chances of being caught will only increase slightly depending on how many neighbors are likely to pass by.

So we need to introduce the interaction in the title of your question, which would leave us with the equation:

$Odds_{punishment} = e^{(\beta_o \,+ \,\alpha\, * \,watchman + \beta_1\, * \,apples + \beta_2\,*\,apples\,*\,watchman\,+\,\varepsilon)}\small \tag 2$.

Now when the watchman is present the apples variable will have a different linear effect - the slope will be: $\beta_1 + \beta_2$ according to equation (2), whereas in the absence of a watchman, the slope will be identical as in equation 1: just $\beta_1$.

• Sorry for the late reply, and thank you for the wonderful answer. I like the binary approach. However I am also interested in predicting the effect of monitoring on the magnitude of punishment. This invites a regression approach, methinks (correct me if I am wrong). We can use your equation (2) as a standard linear regression, no? The dummy term watchman captures the effect on the intercept and the interaction term watchman*apples captures the effect on the slope - the magnitude of punishment. Commented Oct 26, 2015 at 16:50
• @invictus What type of DV would "punishment" be? Would it be ordinal or continuous? Commented Oct 26, 2015 at 17:04
• Continuous. Also, I wonder if there would be a collinearity problem with the logit approach, since on many occasions the dependent variable and the dummy variable will both be unity. Commented Oct 26, 2015 at 17:39
• My understanding is that if the DV is continuous, the logit model is probably not a good choice, and perhaps an OLS is more suitable. Commented Oct 26, 2015 at 17:51