Hello Statalist community,
I am doing logistic regression to look at the effect of two categorical predictors on a binary outcome. I checked the interaction between two of these predictors using LRT and found an interaction. I wish to present individual odds ratios (ORs) for the different combinations of the interacting predictors in reference to the same reference combination. I have gone through the different recommendations in the statalist forum that suggest using the margins, contrast statements and lincom commands and I am honestly confused as to how best achieve my desired objective. I was wondering if someone could kindly show me how to produce individual ORs using the example data and model below. For example, where white non-smokers are the reference, how do I estimate ORs for the joint effects of race and smoking on low birthweight for white smokers, black non-smokers, black smokers etc? Is this possible and if not what would you recommend? Any help with sample code would be greatly appreciated.
Thank you in advance
I am doing logistic regression to look at the effect of two categorical predictors on a binary outcome. I checked the interaction between two of these predictors using LRT and found an interaction. I wish to present individual odds ratios (ORs) for the different combinations of the interacting predictors in reference to the same reference combination. I have gone through the different recommendations in the statalist forum that suggest using the margins, contrast statements and lincom commands and I am honestly confused as to how best achieve my desired objective. I was wondering if someone could kindly show me how to produce individual ORs using the example data and model below. For example, where white non-smokers are the reference, how do I estimate ORs for the joint effects of race and smoking on low birthweight for white smokers, black non-smokers, black smokers etc? Is this possible and if not what would you recommend? Any help with sample code would be greatly appreciated.
Code:
. use "https://www.stata-press.com/data/r17/lbw.dta" (Hosmer & Lemeshow data) . fre race smoke low race -- Race ------------------------------------------------------------- | Freq. Percent Valid Cum. ----------------+-------------------------------------------- Valid 1 White | 96 50.79 50.79 50.79 2 Black | 26 13.76 13.76 64.55 3 Other | 67 35.45 35.45 100.00 Total | 189 100.00 100.00 ------------------------------------------------------------- smoke -- Smoked during pregnancy ----------------------------------------------------------------- | Freq. Percent Valid Cum. --------------------+-------------------------------------------- Valid 0 Nonsmoker | 115 60.85 60.85 60.85 1 Smoker | 74 39.15 39.15 100.00 Total | 189 100.00 100.00 ----------------------------------------------------------------- low -- Birthweight<2500g ----------------------------------------------------------- | Freq. Percent Valid Cum. --------------+-------------------------------------------- Valid 0 | 130 68.78 68.78 68.78 1 | 59 31.22 31.22 100.00 Total | 189 100.00 100.00 ----------------------------------------------------------- . logit low i.race##i.smoke Iteration 0: log likelihood = -117.336 Iteration 1: log likelihood = -108.80624 Iteration 2: log likelihood = -108.41275 Iteration 3: log likelihood = -108.40889 Iteration 4: log likelihood = -108.40889 Logistic regression Number of obs = 189 LR chi2(5) = 17.85 Prob > chi2 = 0.0031 Log likelihood = -108.40889 Pseudo R2 = 0.0761 ------------------------------------------------------------------------------- low | Coef. Std. Err. z P>|z| [95% Conf. Interval] --------------+---------------------------------------------------------------- race | Black | 1.514127 .7522693 2.01 0.044 .0397068 2.988548 Other | 1.742969 .5946187 2.93 0.003 .5775379 2.9084 | smoke | Smoker | 1.750516 .5982763 2.93 0.003 .5779162 2.923116 | race#smoke | Black#Smoker | -.5565938 1.032236 -0.54 0.590 -2.579738 1.466551 Other#Smoker | -1.527373 .8828155 -1.73 0.084 -3.257659 .2029138 | _cons | -2.302585 .5244044 -4.39 0.000 -3.330399 -1.274771 -------------------------------------------------------------------------------
Comment