I have two crosstabs and need to determine whether their differences are significant. Both tables have the same independent variable but different populations. E.g.,

enter image description hereenter image description here

The only test I know to do is to convert these two 2x3 tables into 1x6 tables and then perform a 2x6 chi square. Is this a reasonable way to proceed?

EDIT: Changed the titles of the columns

  • $\begingroup$ Why would they be the same? it seems to be comparing apples with oranges and expecting them to be the same color. By what mechanism could the null be remotely plausible? $\endgroup$ – Glen_b Nov 14 '18 at 0:24
  • $\begingroup$ @Glen_b I changed the title of my sample data to be apples-to-apples. Do you have an answer now? $\endgroup$ – buttonsrtoys Nov 14 '18 at 18:25
  • $\begingroup$ Look up the Cochran Mantel Hanzel Test. Alternatively, you should do a Poisson like regression. $\endgroup$ – Demetri Pananos Nov 14 '18 at 18:49
  • $\begingroup$ What is the hypothesis about the populations? Can you tell me more about the problem you are tackling? $\endgroup$ – Demetri Pananos Nov 14 '18 at 19:06
  • $\begingroup$ @buttonsrtoys changing the name you attach to an orange doesn't make it an apple, and what matters is what they are not what they're labelled. What is it that this test is supposed to tell you about the population? (Perhaps Demetri puts it better -- what is the hypothesis about the population?) $\endgroup$ – Glen_b Nov 14 '18 at 22:58

This looks like a stratified contingency table. I'm assuming here that Meds is an ordinal variable and that the column names are the outcome (e.g. Died or Lived).

You haven't told us what difference you want to evaluate. Between population differences? Between medication type differences? Depending on the complexity of the hypothesis you are evaluating, you can perform a logistic regression. Here is some sample R code:


#Population 1
x = as.table(matrix(c(42,58,44,59,50,47), nrow = 3))
rownames(x) = c(0,1,2)
colnames(x) = c(0,1)
dimnames(x) = list(Meds = c(0,1,2) ,Outcome = c(0,1))

x = as.data.frame.table(x) %>% mutate(Population = 1)

#Population 2
y = as.table(matrix(c(40,64,52,61,44,39), nrow = 3))
rownames(y) = c(0,1,2)
colnames(y) = c(0,1)
dimnames(y) = list(Meds = c(0,1,2) ,Outcome = c(0,1))

y = as.data.frame.table(y) %>% mutate(Population = 2)

data = x %>% 
      bind_rows(y) %>% 
      as.tibble() %>% 
      mutate(Population = factor(Population))

mod = glm(Outcome ~ Meds + Population, data = data, family = binomial(), weights = Freq)


The variables in the model explain some of the variability observed in the data (this is evaluated by a deviance goodness of fit test), but a lot of residual variability remains. Again, the appropriateness of this approach depends on what hypothesis you are evaluating


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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