count <- c(70,324,56,195,332,101,382,199,117)
pview <- factor(c("lib","lib", "lib","mod","mod","mod","cons","cons" 
choice <- factor(rep(c("bush","clinton","perot"),3))
election_dat <- data.frame(count, pview, choice)

election_sat <- MASS::loglm(count ~ pview + choice + pview*choice, data = 

election_sat_glm <- glm(count ~ pview + choice + pview*choice, data = 
election_dat, family = poisson())

This is the data for 3x3 table and both model functions that I'm interested in. I didn't have any problems interpreting 2x2 models but for some reason with the 3x3, my calculations for odds and odds ratios using the coefficients aren't matching my calculations using the sample data.

Here's the table with margin totals and the coefficient estimates for both models.

elect_tab <- vcd::mar_table(xtabs(count~pview+choice))
 pview   bush clinton perot TOTAL
  cons   382     199   117   698
  lib     70     324    56   450
  mod    195     332   101   628
  TOTAL  647     855   274  1776

# ----------------------------------

[1] 5.083194

      cons        lib        mod 
 0.2504392 -0.3983304  0.1478911 

      bush    clinton      perot 
 0.0724446  0.5432006 -0.6156452 

pview         bush     clinton         perot
  cons  0.53934289 -0.58352886  0.0441859714
  lib  -0.50881284  0.55267947 -0.0438666328
  mod  -0.03053005  0.03084939 -0.0003193386

# ---------------------------------

       (Intercept)               pviewlib               pviewmod 
         5.9454206             -1.6969254             -0.6724211 
     choiceclinton            choiceperot pviewlib:choiceclinton 
        -0.6521158             -1.1832467              2.1843641 
pviewmod:choiceclinton   pviewlib:choiceperot   pviewmod:choiceperot 
         1.1842512              0.9601031              0.5253676 

For example:

  1. Of the liberals and conservatives that voted for Bush, what are the odds a voter is conservative rather than liberal? Liberal rather than conservative?

  2. In a Bush vs Clinton election, what's the odds ratio that compares the odds of a Bush voter is conservative rather than liberal? Liberal rather than conservative?

  • $\begingroup$ Can you get the odds and odds ratio from the first table (counts of the people)? I can calculate from two models anything you can calculate from the first table. $\endgroup$ – user158565 Nov 30 '18 at 4:06

I was calculating the odds incorrectly using the estimates from the saturated model, but I was also having difficulty connecting the interpretations to what was happening in the table. In the questions, the language is similar for both odds and odds ratio, but the "universe" that both table calculations take place in is different. For odds, the universe is a single column in the 3x3 table (e.g. "bush"). For the odds ratio, the universe is two columns (e.g. "bush" and "clinton"). Both calculations involve two rows which in this case are the conservative and liberal rows. This should be the case for any IxJ table. There are many different ways these questions can be asked and answered, so it can be tricky to keep things straight.

Answer to 1a:

# table calculation: (bushcons/(bushcons+bushlib)) /(1 - (bushcons/(bushcons+bushlib))
#  = 5.457143

# also using the MASS::loglm estimates in $pview and $pview.choice
# exp(cons + bushcons - lib - bushlib)
exp(0.2504392 + 0.53934289 - -0.3983304 - -0.50881284)

We can interpret this as meaning: Of the conservatives and liberals that voted for Bush, voters are five times more likely to be conservative than liberal.

Answer to 1b is just the inverse of 1a:

# = 0.1832461
1 / exp(0.2504392 + 0.53934289 - -0.3983304 - -0.50881284)

Answer to 2a:

# table calculation: (bushcons * clintonlib) / (clintoncons * bushlib)
# = 8.884996
(382 * 324) / (199 * 70)

# Using the MASS::loglm estimates in $pview.choice
# (exp(bushcons) * exp(clintonlib)) / (exp(clintoncons) * exp(bushlib))
(exp(0.53934289) * exp(0.55267947)) / (exp(-0.58352886) * exp(-0.50881284))

Here we can say that, "In a Bush vs Clinton election, a Bush voter is 8 times more likely to be conservative than liberal," or "The odds of a Bush voter being conservative are 8 times greater than the odds of a Bush voter being liberal in a Bush vs Clinton election."

Answer to 2b is the inverse of 2a:

# = 0.1125493
1 / (((exp(0.53934289) * exp(0.55267947)) / (exp(-0.58352886) * exp(-0.50881284)))

As for using the glm estimates, the answer to 2a is

# pviewlib:choiceclinton = 2.1843641

For more information on this topic, I recommend https://onlinecourses.science.psu.edu/stat504/node/69/ and https://onlinecourses.science.psu.edu/stat504/node/118/


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.