Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Odds Ratios and Margins Question

    Hello all!

    My professor doesn't really know the answer to this question so why don't I try here. When calculating Odds ratios in linear regression the odds ratio was explained as the risk multiplier for the outcome. Say Race has categories 1, 2, and 3. 1 is used as control, so 2 and 3 are compared to one. 2 has value of 1.6 and 3 has 1.9. I took this as stata saying if in race group 2 you are 1.6x as likely to be in group 1 (0,1 with 1 being true, 0 being false) for the outcome when adjusted for all other covariates in the regression.

    The margins command supposedly relays the risk value of each category of race while accounting for all covariates of the previous regression. The margins results were 1= .21, 2= .312, 3= .314. This is read as you have 21% chance of having outcome group 1 if in race group 1 and 32.1% for group 2 etc. If you are 1.6x as likely to be in group 1 for the outcome when in race group 2 compared to 1 (as relayed by linear regression odds ratio) then why arent the margin results following that rule? Shouldn't the margin for 2 be 1.6x the margin for 1?

    What am I missing?

  • #2
    how did you get an odds ratio from linear regression? as far as I know this is not possible

    Comment


    • #3
      No, there are several misunderstandings in your reasoning here.

      First, an odds ratio of 1.6 does not mean you are 1.6x as likely to be in group 1.... "Likely" refers to probabilities (and the -margins- outputs are also probabilities); but odds ratios are calculated from odds. So an odds ratio does not, in fact, correspond to any particular probability ratio: it depends on the base probablity. In your specific situation, the probability for group 1 is .21 and for group 2 it is .312. Let's calculate the odds ratio from that: it's (.21/(1-.21))/(.312/(1-.312)) which works out to 1.71.

      As it happens that's not too far from 1.6, but still different. Why? Well, the way -margins- calculates these probabilities is it calculates a predicted probability, based on your logistic regression model, for each observation in the data set. Then it averages those predicted probabilities. These predicted probabilities will depend not only on the race variable but also on all of the other variables in your model. So even among people with the same value of the race variable, the predicted probabilities will differ. If you then average those to get an overall probability for that race group, when you calculate the odds ratio from that, that is not the same thing as taking an average odds ratio, because the the relationship between odds ratio and probability is non-linear.

      On top of that, the odds ratio calculated in the logistic regression is not an average odds ratio, nor is it based on the probabilities in the entire racial group. Rather, it is a single odds ratio that characterizes the odds ratio for the outcome between hypothetical people who are in racial group 2 and hypothetical people who are in racial group 1 assuming that all the other variables in the model are the same for both groups--which is the opposite of what -margins does, which takes the actual values of all the other variables into account. And those values of the other variables are almost never the same in both groups.

      So, all in all, the confusion is understandable. So, you just have to bear in mind that the odds-ratio metric is really rather distant from the probability metric, except for probabilities very close to zero. So the results presented as odds ratios can look very, very different from the results presented as probability ratios or probability differences.

      Added: Crossed with #2. It isn't possible to get an odds ratio from a linear regression. I just assumed the O.P. meant logistic regression.
      Last edited by Clyde Schechter; 03 Apr 2024, 19:12.

      Comment


      • #4
        Originally posted by Clyde Schechter View Post
        No, there are several misunderstandings in your reasoning here.

        First, an odds ratio of 1.6 does not mean you are 1.6x as likely to be in group 1.... "Likely" refers to probabilities (and the -margins- outputs are also probabilities); but odds ratios are calculated from odds. So an odds ratio does not, in fact, correspond to any particular probability ratio: it depends on the base probablity. In your specific situation, the probability for group 1 is .21 and for group 2 it is .312. Let's calculate the odds ratio from that: it's (.21/(1-.21))/(.312/(1-.312)) which works out to 1.71.

        As it happens that's not too far from 1.6, but still different. Why? Well, the way -margins- calculates these probabilities is it calculates a predicted probability, based on your logistic regression model, for each observation in the data set. Then it averages those predicted probabilities. These predicted probabilities will depend not only on the race variable but also on all of the other variables in your model. So even among people with the same value of the race variable, the predicted probabilities will differ. If you then average those to get an overall probability for that race group, when you calculate the odds ratio from that, that is not the same thing as taking an average odds ratio, because the the relationship between odds ratio and probability is non-linear.

        On top of that, the odds ratio calculated in the logistic regression is not an average odds ratio, nor is it based on the probabilities in the entire racial group. Rather, it is a single odds ratio that characterizes the odds ratio for the outcome between hypothetical people who are in racial group 2 and hypothetical people who are in racial group 1 assuming that all the other variables in the model are the same for both groups--which is the opposite of what -margins does, which takes the actual values of all the other variables into account. And those values of the other variables are almost never the same in both groups.

        So, all in all, the confusion is understandable. So, you just have to bear in mind that the odds-ratio metric is really rather distant from the probability metric, except for probabilities very close to zero. So the results presented as odds ratios can look very, very different from the results presented as probability ratios or probability differences.

        Added: Crossed with #2. It isn't possible to get an odds ratio from a linear regression. I just assumed the O.P. meant logistic regression.
        Thank you Clyde! I can't say I understand entirely, but at least I no longer think something that is in pratice wrong.

        Comment

        Working...
        X