Announcement

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

  • multiple logit odds ratio

    Hello,

    I was trying to calculate odds ration in an example for myself, and first I had no problem with it. Here is an example:
    Code:
    clear
    * data and preparation for the example
    use http://www.stata-press.com/data/r15/sysdsn1.dta
    keep if site < 3
    drop if insure == 3
    
    * calculation
    logit ppd2 i.insure, or        // OR = 28.44898
    margins insure, expression(exp(xb()))
    matrix list r(table)
    mat m = r(table)
    display m[1,2] / m[1,1]        // OR = 28.44898
    So via margins and using the matrix I could easily calculate the OR of insure. But using another independed variable in the model, the calculation has differences:
    Code:
    logit ppd2 i.insure i.site, or                // insure OR = 29.51753, site OR = 0.6142358
    margins insure site, expression(exp(xb()))
    matrix list r(table)
    mat m = r(table)
    * insure OR
    display m[1,2] / m[1,1]        // OR = 29.517533
    * site OR
    display m[1,4] / m[1,3]        // OR = 0.61423582
    I know that the difference is small and so I tried an interaction mode, too:
    Code:
    logit ppd2 i.insure##i.site, or                // insure OR = 30.28333, site OR = 0.6234737
    margins insure site, expression(exp(xb()))
    matrix list r(table)
    mat m = r(table)
    * insure OR
    display m[1,2] / m[1,1]        // OR = 29.674937
    * site OR
    display m[1,4] / m[1,3]        // OR = 0.6018451
    Finally, there must something to be done when calculating the OR via margins, but I don't get it. Hope you have an idea.

    -Nick

  • #2
    Sorry, gad the delete a false entry. The question is still a question.
    Last edited by Nick Bornschein; 01 Feb 2019, 06:06.

    Comment


    • #3
      Ok, now I got it. Took me some time to find out...

      Comment

      Working...
      X