Hi David,
Thanks for your interest in develop my post. I grateful your comments.
Here I attach dta file. Sorry I forgot mention that for this excercise crew class was droped in the book previosluy.
I expected that my sex#class interactions were the results of the book posted previously.
My do file to get tables:
Thanks for your interest in develop my post. I grateful your comments.
Here I attach dta file. Sorry I forgot mention that for this excercise crew class was droped in the book previosluy.
I expected that my sex#class interactions were the results of the book posted previously.
My do file to get tables:
Code:
use titanic, clear drop if class==4 logit sur i.sex##i.class, nolog Logistic regression Number of obs = 1316 LR chi2(5) = 515.16 Prob > chi2 = 0.0000 Log likelihood = -615.79775 Pseudo R2 = 0.2949 -------------------------------------------------------------------------------- survived | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---------------+---------------------------------------------------------------- sex | man | -4.206016 .5307502 -7.92 0.000 -5.246267 -3.165764 | class | 2nd class | -1.594815 .5871695 -2.72 0.007 -2.745646 -.4439844 3rd class | -3.726095 .526913 -7.07 0.000 -4.758825 -2.693365 | sex#class | man#2nd class | .4202889 .644876 0.65 0.515 -.8436449 1.684223 man#3rd class | 2.801977 .5621158 4.98 0.000 1.70025 3.903703 | _cons | 3.562466 .5070426 7.03 0.000 2.56868 4.556251 -------------------------------------------------------------------------------- logit sur i.sex##i.class, or nolog Logistic regression Number of obs = 1316 LR chi2(5) = 515.16 Prob > chi2 = 0.0000 Log likelihood = -615.79775 Pseudo R2 = 0.2949 -------------------------------------------------------------------------------- survived | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval] ---------------+---------------------------------------------------------------- sex | man | .0149056 .0079112 -7.92 0.000 .0052671 .0421819 | class | 2nd class | .202946 .1191637 -2.72 0.007 .0642068 .6414754 3rd class | .0240867 .0126916 -7.07 0.000 .0085757 .0676529 | sex#class | man#2nd class | 1.522401 .9817601 0.65 0.515 .4301398 5.388261 man#3rd class | 16.47718 9.262086 4.98 0.000 5.475316 49.58575 | _cons | 35.25 17.87325 7.03 0.000 13.04859 95.22579 -------------------------------------------------------------------------------- margins i.sex#i.class, expression(exp(predict(xb))) mat b = r(b) scalar base = b[1,1] margins i.sex#i.class, expression((exp(predict(xb))/base)) Predictive margins Number of obs = 1316 Model VCE : OIM Expression : (exp(predict(xb))/base) over : sex class ---------------------------------------------------------------------------------- | Delta-method | Margin Std. Err. z P>|z| [95% Conf. Interval] -----------------+---------------------------------------------------------------- sex#class | women#1st class | 1 .5070426 1.97 0.049 .0062148 1.993785 women#2nd class | .202946 .0600925 3.38 0.001 .0851669 .3207251 women#3rd class | .0240867 .0034525 6.98 0.000 .01732 .0308535 man#1st class | .0149056 .002338 6.38 0.000 .0103232 .0194881 man#2nd class | .0046053 .000993 4.64 0.000 .002659 .0065516 man#3rd class | .0059158 .0006933 8.53 0.000 .004557 .0072745 ---------------------------------------------------------------------------------- logit sur b1.sex##i.class, or nolog Logistic regression Number of obs = 1316 LR chi2(5) = 515.16 Prob > chi2 = 0.0000 Log likelihood = -615.79775 Pseudo R2 = 0.2949 ---------------------------------------------------------------------------------- survived | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval] -----------------+---------------------------------------------------------------- sex | women | 67.08871 35.60735 7.92 0.000 23.70686 189.8562 | class | 2nd class | .3089652 .0823826 -4.40 0.000 .1832082 .5210439 3rd class | .3968812 .0777086 -4.72 0.000 .2703939 .5825379 | sex#class | women#2nd class | .6568571 .4235914 -0.65 0.515 .1855886 2.324825 women#3rd class | .06069 .0341148 -4.98 0.000 .0201671 .1826379 | _cons | .5254237 .0824155 -4.10 0.000 .3863618 .7145378 ----------------------------------------------------------------------------------
Comment