0
$\begingroup$

I have analyzed the odds ratio (and risk ratio) from a 2x2 contingency table - I have calculated the odds of Y is true (i.e. =1) given that X1 is true (i.e. =1) versus X1 is false (i.e. =0). The result is a statistically significant odds ratio (and risk ratio) greater than 1.

I now have a second variable (X2), and in the same way (2x2 contingency table) have calculated the odds ratio (and risk ratio) to be greater than 1.

But ... I have an expectation (from domain knowledge in my field) that when X2=0 the influence of X1 on Y may be reduced (i.e. there is an interaction between independent variables). I want to test this hypothesis - and am looking for advice on how best to do so.

An approach I have done so far (but I am looking for suggestions as to why this might not be appropriate) is that I have formed a third contingency table counting the number of times our outcome is true for (X1=1 while X2=0) versus the number of times outcome is true for (X1=1 while X2=1). In doing so I observe that the case (X1=1 while X2=0) results in lower odds of the outcome compared to (X1=1 while X2=1). Is it appropriate to form contingency tables this way? If not can you please explain why not and suggest why other alternate approaches may be better (i.e. logistic regression?).

Thanks in advanced, I am familiar with R if that may guide suggestions.

$\endgroup$

1 Answer 1

3
$\begingroup$

Probably not appropriate unless I misunderstood what your analysis meant. A 2x2 interaction cannot be examined just by looking at 2 of the 4 categories.

Let's cast this into an ANOVA looking at mean rather than odds. Let's say the mean of $X_{11}$ is 10 and $X_{10}$ is 5. These alone cannot prove interaction, because $X_{01}$ can be 17 and $X_{00}$ can be 12. In that case there is no interaction. Having the first subscript as 1 lowers the mean by 7, having the second subscript as 1 increases the mean by 5.

A better way is to model the four odds in logistic regression:

$logit(Y) = \beta_0 + \beta_1 X1 + \beta_2 X2 + \beta_3 (X1\times X2)$

Four means can be retrieved here:

$\beta_0$: when both are 0

$\beta_0 + \beta_1$: when X1 = 1 and X2 = 0

$\beta_0 + \beta_2$: when X1 = 0 and X2 = 1

$\beta_0 + \beta_1 + \beta_2 + \beta_3$: when both are 1

$\beta_3$ captures the extra adjustment due to interaction. If there is no interaction it should be 0. Hence, the p-value of $\beta_3$ tests the interaction.

$\endgroup$
2
  • $\begingroup$ Thank you - that is exactly what I was looking for. My understanding is that this could be coded in R using: $\endgroup$
    – Peter
    Commented Oct 16, 2016 at 21:34
  • $\begingroup$ mylogit <- glm(Y ~ X1 + X2+ (X1*X2), data = mydata2, family = "binomial") $\endgroup$
    – Peter
    Commented Oct 16, 2016 at 21:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.