Announcement

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

  • Forest Plot for the adjusted Odds ratio

    I want to do a forest plot for the odds ratios after I did logistic regression for prevalence of many diseases across different races and gender. But the code does not work with me.


    I would appreciate any help with the code!


    I have Stata 17 MP

    This is a sample of my database:

    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(CONS GP Dysphagia GERD Functional_dyspepsia Diarrhea OBESITY UC CD Incontinence PKNS)
    0 0 1 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 1 1 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 1 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 1 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 1 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    1 0 0 0 0 0 1 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 1 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 1 0 0 0 0 0 0 1
    1 0 0 0 0 0 1 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 1 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 1 0 0 0 0 0 0 0 1
    0 0 1 0 0 0 0 0 0 0 1
    0 0 1 0 0 0 0 0 0 0 1
    0 0 1 1 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 1 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 1 0 1 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 1 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 1 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 1 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 1 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 1 0 0 0 0 0 0 1
    0 0 1 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    1 0 0 1 0 0 1 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    1 0 0 0 0 0 1 0 0 0 1
    0 0 0 1 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 1 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 1 0 0 0 0 0 0 0 1
    1 0 0 1 0 0 1 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 1 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 1 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 1 0 0 0 0 0 0 1
    0 0 1 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    1 0 0 0 0 0 1 0 0 0 1
    0 0 0 1 0 0 0 0 0 0 1
    1 0 0 0 0 1 1 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 1 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    0 0 0 1 0 0 0 0 0 0 1
    0 0 0 1 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 1
    1 0 0 0 0 0 1 0 0 0 1
    0 0 1 0 0 0 0 0 0 0 1
    end


    This is 100 out of 52284 observations.



    This an example of the for aORs after the logistic regression.
    GI symptoms Female White AA Hispanic or Latino Asian or Pacific Islander Native American
    aOR P-value aOR P-value aOR P-value aOR P-value aOR P-value
    GERD 1.34 [1.24 - 1.44] 0.001 0.64 [0.55 - 0.74] 0.001 0.71 [0.61, 0.83] 0.61 [0.47 - 0.79] 0.92 [0.47 -1.80] 0.81
    Dyphagia 0.83 [0.75 - 0.91] 0.01 1.23[1.04 - 1.45] 0.01 1.21 [1.02 - 1.44] 0.03 1.17 [0.92 - 1.49] 0.21 1.065 [0.45 - 2.54] 0.88
    CONS 1.40 [1.24 - 1.57] 0.01 0.58 [0.45 - 0.74] < 0.01 0.92 [0.53 - 1.60] 0.77 0.20 [0.10 - 0.38] 0.00 0.38 [0.10 - 1.51] 0.17
    IBS 2.86 [2.09 -3.90] 0.01 0.40 [0.17 - 0.93] 0.03 0.38 [0.16 - 0.94] 0.036 NA NA
    Incontinence 0.83 [0.60 - 1.15] 0.27 1.49 [0.92 - 2.42] 0.10 0.94 [0.50 - 1.77] 0.86 1.23 [0.53 - 2.82] 0.63 NA
    Diarrhea 1.19 [0.92 - 1.55] 0.18 0.66 [0.36 - 1.20] 0.17 0.72 [0.57 - 0.91] 0.01 0.82 [0.35 - 1.92] 0.65 NA
    GP 3.09 [2.05 - 4.66] 0.00 0.83 [0.41 - 1.69] 0.61 0.52 [0.18 - 1.44] 0.21 0.32 [0.04 - 2.34] 0.26 NA
    UC 1.45 [0.83 - 2.53] 0.19 0.25 [0.03 - 1.79] 0.17 0.27 [0.04 -1.98] 0.20 NA 6.78 [0.86 - 53.18] 0.07
    CD 1.70 [0.99 - 2.93] 0.05 0.61 [0.19 - 1.97] 0.41 0.61 [0.08 - 4.62] 0.63 NA NA
    Functional dyspepsia 1.51 [0.58 - 3.95] 0.40 NA NA 0.86 [0.10 - 7.56] 0.89 2.07 [0.25 - 17.28] 0.50 NA
    Last edited by Mohamed Eldesouki; 20 Nov 2024, 14:54.

  • #2
    You could use coefplot from SSC with the -eform- option. Even though logistic reports odds ratios, the stored values are the coefficients. However, the odds ratios are simply the exponentiated coefficients.

    Comment

    Working...
    X