# How to interpret dummy and ratio variable interactions in R

I have performed a regression examining data on crime rates. It looks at a standard ratio type variable (beginning crime rate at a point in time) and a dummy variable (if the countries crime rate is in the top mid or bottom third of beginning crime rates). We consider the effect upon the change in crime over time, crmdelta. The model code and HC standard error regression output is as follows:

df$rank.f <- factor(df$rank)
eqn1 <- lm(crmdelta ~ crmbegin+rank.f+(crmbegin*rank.f), data=df)

Estimate Std. Error t value Pr(>|t|)
(Intercept)       3.57085    4.04330  0.8832  0.37839
crmbegin         -0.15049    0.29486 -0.5104  0.61045
rank.f2          -3.38911    4.22533 -0.8021  0.42361
rank.f3           1.59112    4.69654  0.3388  0.73518
crmbegin:rank.f2  0.16871    0.43199  0.3906  0.69661
crmbegin:rank.f3 -3.12450    1.64205 -1.9028  0.05874 .


2 questions:

(1) I cant tell what happened to the interaction crmbegin:rank.f1. Is this represented by crmbegin? And if so, is there no lone crmbegin variable even though it was specified in the regression?

(2) How do I precisely interpret the coefficients on the interactions? Is it the effect of the ratio variable given the singular case of whichever dummy is in effect? Ie. crmbegin:rank.f2 is the marginal effect of crmbegin, given we are operating in rank.f2 data subset?

Thanks very much for any help. My first post here and looks like a great community.

• My mistake, I apologise. Cross validated is for stats then? Thats awesome thanks for that. And thanks for the code tip
– Luke
Jul 4 '16 at 4:51
• This is a CV question. He just needs to change the title and rephrase it a bit so they don't eat him alive over there. Jul 4 '16 at 5:25

Sigh... out of the concern that they will "eat you alive" over there on Cross Validated, I might give you a brief answer. My answer will be migrated along with your question. (So Stack Overflow fellows, do not vote me down, please.)

Your model is a regression line per group:

crmdelta = alpha[i] + beta[i] * crmbegin


where group rank_fi has intercept alpha[i] and slop beta[i].

• (Intercept): alpha[1]
• crmbegin: beta[1]
• rank.f2: alpha[2] - alpha[1]
• rank.f3: alpha[3] - alpha[1]
• crmbegin:rank.f2: beta[2] - beta[1]
• crmbegin:rank.f3: beta[3] - beta[1]

If you ask why it is like this, well, it is due to the contrast treatment of factor variables.

misc

crmbegin:rank.f2 is not a ratio variable; : denotes interaction.

You can replace your call to lm() by: eqn1 <- lm(crmdelta ~ crmbegin * rank.f, data=df) (Read ?formula for more on this).

• Thank you. Sorry, I meant ratio as a data type as opposed to binary dummy. This makes good sense, I actually started to get this understanding as I continued to research on google (which I necessarily always do first as well). I have a follow up, which is entirely R based: Is it possible to regress my crmdelta onto crmbegin and rank.f1 only for a seperate regression?
– Luke
Jul 4 '16 at 6:11