1、9 sSTATAK ,1TK 6 , v 4 2 “2.0=B M BIIK , c 2007 2010b = bz | “ - n4 v 4 2 = 3 Pb?z “=BS q l 4 2 STATA = _ hvE 4in aV p#pY3%b PK 4 2S = h. b“ c EcLogistic 115.1e. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115.2=Logit . . . . . . . . . . . . . . . . . . .
2、. . . . . . . . . . . . . . . . . . . . 115.2.1=s. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115.2.2 LogitM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215.2.3 Logistic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3、. 215.2.49. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315.2.5L !_. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615.2.6 d E. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715.3Logit . . . . . . . . . . . . . . . . . . . . . .
4、 . . . . . . . . . . . . . . . . 1215.3.19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1215.3.2L !_. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1815.3.3 E. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2715
5、.3.4 d. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2815.4 STATA1Logitech 7 . . . . . . . . . . . . . . . . . . . . . . . . 33III EcLogistic 15.1eV = E Mlogistic 5 chi2 = 0.0000Log likelihood = -27.175156 Pseudo R2 = 0.3966foreign Coef. Std. Err. z P|z| 95% Conf. Intervalwe
6、ight -.0039067 .0010116 -3.86 0.000 -.0058894 -.001924mpg -.1685869 .0919174 -1.83 0.067 -.3487418 .011568_cons 13.70837 4.518707 3.03 0.002 4.851864 22.56487$ dM foeign, |(0V UoSp 1V Uo gp)b1 dM 1=M Stata|yi D04loYp(negative outcomes)7| d ( )loYp(positive outcomes)byN E jyp S|$ dM l0/1Mb15.2=LOGIT
7、6 weightV U mpgV U bV AV5Q L MLE9 bTV ZStata4 “ (Number of obs = 74)a (Log likelihood = -27.18)H4 Bt ES |/ +lW bTV U M 9“ (Coef.)aS(Std.Err.)azd9 ap#95% uWb15.2.5L !_“ T L !Hq ? 5MLE9 vV sbyNL!H0 : j D0 Vz d9 _z j DO jse.O j/: 0TV4 5 sY “ zMpbweightM V / v g ql O1% Ab Vtest 7lrtest 7sYWald_ 1_(LR te
8、st)b_ H_M A VWald_ 1_(LR test)bStata Vtestlrtest 7 _bExampleWald_:1_weightmpg M A / 7 V. test weight mpg( 1) weight = 0( 2) mpg = 0chi2( 2) = 17.78Prob chi2 = 0.0001Vnweightmpg1% AY o gp qbLR_: 2 1_d9 :G D 2 ln OLC ln OL NC 2.p/2 PLR_ H1i L !Hq: (1) A 3*(nested)1“; (2)9 VA PM“bQ L !Hq B_T b EcLOGIST
9、IC 7ln LCln L NCsYV U f / bp b HqH0 : weight D mpg D0pD2bLR_Stata 7 /. qui logit foreign. est store logit0. qui logit foreign wei mpg. est store logitfull. lrtest logitfull logit0Likelihood-ratio test LR chi2(2) = 35.72(Assumption: logit0 nested in logitfull) Prob chi2 = 0.0000%i 9 1d9 (LR chi2(2)=3
10、5.72)5: Plogit 7T B“b Y L _ “ M A V 8 Eb 1 “ A“ Vtestlrtest 7_ZE b15.2.6 d E“ cl (15-6)“ jcl V d / M M f /jM MBlogit|M jb5ln. i/M j6cl 4 dbV V(15-6) T H H i4 ; 1i Dexp.x0i /: (15-16)L !j dM M15i .xi;xi j C1/Dexp.x0i /exp. j/ (15-17)(15-16)(15-17) T V 1(odds ratio)3.x;x j C1/.x;x j/ Dexp. j/ (15-18)y
11、Nexp. j/cl V d M M f /x jMB ; 1(odds)|Mexp. j/bexp. j/ 15V Uo ; 19v exp. j/p; exp. j/ chi2 = 0.0000Log likelihood = -17.161893 Pseudo R2 = 0.6189foreign Odds Ratio Std. Err. z P|z| 95% Conf. Intervalweight .9931737 .0019856 -3.43 0.001 .9892895 .9970731mpg .8859526 .0847702 -1.27 0.206 .7344554 1.06
12、8699price 1.000927 .0003076 3.01 0.003 1.000324 1.00153 nologT UWTbStata4 6BH 7 logistic V MT. logistic foreign wei mpg price(output omitted )1 M Y “ 9i7Y ; 1b. gen price2 = price/1000. logit foreign wei mpg price2, or nologLogistic regression Number of obs = 74LR chi2(3) = 55.74Prob chi2 = 0.0000Lo
13、g likelihood = -17.161893 Pseudo R2 = 0.6189foreign Odds Ratio Std. Err. z P|z| 95% Conf. Intervalweight .9931737 .0019859 -3.43 0.001 .9892889 .9970737mpg .8859526 .0847728 -1.27 0.206 .734451 1.068706price2 2.525378 .7762324 3.01 0.003 1.38258 4.612778 n5l BM price2=price/1000priceM o1$p7price2 5o
14、1,000$pbA priceprice29“ W1“1000 price D price2= ; 1W1“9 exp.1000 price/Dexp. price2/b V / 7B1“. dis exp(1000*ln(1.000927)2.5258322Plistcoef 7 V H1M MBBS H ; 1b44listcoef 7idStata11/ 7findit listcoefb EcLOGISTIC 9. qui logit foreign wei mpg price. listcoef, help constantlogit (N=74): Factor Change in
15、 OddsOdds of: Foreign vs Domestic-foreign | b z P|z| eb ebStdX SDofX-+-weight | -0.00685 -3.426 0.001 0.9932 0.0049 777.1936mpg | -0.12109 -1.266 0.206 0.8860 0.4963 5.7855price | 0.00093 3.014 0.003 1.0009 15.3695 2949.4959_cons | 14.42237 2.664 0.008-b = raw coefficientz = z-score for test of b=0P
16、|z| = p-value for z-testeb = exp(b) = factor change in odds for unit increase in XebStdX = exp(b*SD of X) = change in odds for SD increase in XSDofX = standard deviation of X FhelpT4“ W% dconstant P 9“ S9 U bE L E H PK10dzExamplelogit 7 ?9 McFaddens R2 d9 Vfitstat 79 b55 791/findit fitstatb EcLOGIST
17、IC 11. qui logit foreign wei mpg price. fitstatMeasures of Fit for logit of foreignLog-Lik Intercept Only: -45.033 Log-Lik Full Model: -17.162D(70): 34.324 LR(3): 55.743Prob LR: 0.000McFaddens R2: 0.619 McFaddens Adj R2: 0.530Maximum Likelihood R2: 0.529 Cragg 1 AY L M mn s(indistinguishable)bm4n4s
18、/L !H0 : 1;mjn D 2;mjn D K;mjn D0“ VWald_aLR_#mlogtest 7 _L !bWald_1_MenialFProf sL !H0 V / 7. qui mlogit occ ed exper white. test Menial( 1) Menialed = 0( 2) Menialexper = 0( 3) Menialwhite = 0chi2( 3) = 48.19Prob chi2 = 0.0000A V1% H0b X4mlogit V j HJ 1=logit 9b MenialS U ZFMenialFZb_ FY F H Vtest
19、 g1=g2 7_b 1_MenialFBlueColF Vi V / 7. qui mlogit occ ed exper white. test Menial=BlueCol( 1) Menialed - BlueColed = 0( 2) Menialexper - BlueColexper = 0( 3) Menialwhite - BlueColwhite = 0chi2( 3) = 3.99Prob chi2 = 0.2622N HE L !H0i“MenialFBlueColF VibTX1 chi2Menial- BlueCol 3.994 3 0.26215.3LOGIT 2
20、2Menial- Craft 3.203 3 0.361Menial-WhiteCol 11.951 3 0.008Menial- Prof 48.190 3 0.000BlueCol- Craft 8.441 3 0.038BlueCol-WhiteCol 20.055 3 0.000BlueCol- Prof 76.393 3 0.000Craft-WhiteCol 8.892 3 0.031Craft- Prof 60.583 3 0.000WhiteCol- Prof 22.203 3 0.000 T -test 7T MbLR_ 1_ 7BtbL ! X1_MenialFCraftF
21、 H0bB9 iest store 7 i9T. qui mlogit occ ed exper white. est store mFull=l Hq. constraint define 88 Menial l B|o88p Hq Hq| V ib MenialV UMenialZ“ B“ |$K0b 9 s . mlogit occ ed exper white, constraint(88) base(3) nologMultinomial logistic regression Number of obs = 337LR chi2(9) = 162.71Prob chi2 = 0.0
22、000Log likelihood = -428.48872 Pseudo R2 = 0.1596( 1) Menialed = 0( 2) Menialexper = 0( 3) Menialwhite = 0occ Coef. Std. Err. z P|z| 95% Conf. IntervalMenialed (dropped)exper (dropped)white (dropped)_cons -.9968296 .2101495 -4.74 0.000 -1.408715 -.5849441BlueColed -.1692062 .072927 -2.32 0.020 -.312
23、1406 -.0262719exper -.0159621 .0118351 -1.35 0.177 -.0391584 .0072343white .8996341 .6000098 1.50 0.134 -.2763634 2.075632_cons 1.272306 1.108384 1.15 0.251 -.9000863 3.444699 EcLOGISTIC 23WhiteColed .282673 .0905912 3.12 0.002 .1051175 .4602285exper .0134852 .0134583 1.00 0.316 -.0128926 .039863whi
24、te 1.224243 .7970745 1.54 0.125 -.3379941 2.78648_cons -5.680546 1.551065 -3.66 0.000 -8.720577 -2.640514Profed .7083396 .086451 8.19 0.000 .5388988 .8777805exper .0143989 .0122011 1.18 0.238 -.0095148 .0383126white 1.423901 .6211473 2.29 0.022 .2064751 2.641328_cons -10.9538 1.477455 -7.41 0.000 -1
25、3.84956 -8.058043(occ=Craft is the base outcome). est store m01i X11 MenialFCraftF“ 9 s H1 !base(3)CraftFb H l HqYVconstraint(88) F 9V P TMenial d M“ A U(dropped)b Plrtest 7LR_. lrtest mFull m0Likelihood-ratio test LR chi2(3) = 3.38(Assumption: m0 nested in mFull) Prob chi2 = 0.3371 LR_“ Vmlogtest 7
26、 LCFlrcomb V. qui mlogit occ ed exper white. mlogtest, lrcomb* LR tests for combining alternatives (N=337)Ho: All coefficients except intercepts associated with a given pairof alternatives are 0 (i.e., alternatives can be collapsed).Alternatives tested chi2 df Pchi2Menial- BlueCol 4.095 3 0.251Menia
27、l- Craft 3.376 3 0.337Menial-WhiteCol 13.223 3 0.004Menial- Prof 64.607 3 0.000BlueCol- Craft 9.176 3 0.027BlueCol-WhiteCol 22.803 3 0.000BlueCol- Prof 125.699 3 0.000Craft-WhiteCol 9.992 3 0.019Craft- Prof 95.889 3 0.000WhiteCol- Prof 26.736 3 0.0001F (IIA)_MNLM |1 Hqlogit T 1F L !(indepen-15.3LOGI
28、T 24dence of irrelevant alternatives, IIA)b MNLM bN Pr.yDmjx/Pr.yDnjx/ Dexpx. mjb njb/ ; 1 4YN H“mn4o1Fp(irrelevant)bB9Fh 4iYmnW ; 1bIIAL ! _ZEHausman_Small-Hsiao_bHausman_1.9c J4 “ 9O F 2. “B479 s “ 9O R 3. !O F “ _ O F0_ c s $ “FY“ 5Hausman_d9 H DOR O F0hcVarORcVarOFi 1 OR O FL !5Hd9 vV 5Zs1 s O R
29、 b Hd9 A5 IIAL !bIIAL !Hausman_ VStata1hausman 7g V 4mlogtest 7 yb hausman 7T /. qui mlogit occ ed exper white,base(5). est store mFull. qui mlogit occ ed exper white if occ!=1. est store mRist. hausman mRist mFull, alleq constantCoefficients(b) (B) (b-B) sqrt(diag(V_b-V_B)mRist mFull Difference S.E
30、.BlueColed -.8676683 -.8782767 .0106083 .0174389exper -.0351913 -.0309296 -.0042616 .0039591white -.3934012 -.5378027 .1444015 .2288717_cons 12.05776 12.25956 -.2018008 .2886674Crafted -.6654823 -.6850365 .0195543 .exper -.0101465 -.0079671 -.0021794 .0026934white -1.200918 -1.301963 .1010449 .16687
31、77_cons 10.11725 10.42698 -.3097295 .1653175 EcLOGISTIC 25WhiteColed -.4152466 -.4256943 .0104477 .exper -.0021786 -.001055 -.0011236 .0026561white -.1604771 -.2029212 .0424441 .1004285_cons 5.115878 5.279722 -.1638448 .b = consistent under Ho and Ha; obtained from mlogitB = inconsistent under Ha, e
32、fficient under Ho; obtained from mlogitTest: Ho: difference in coefficients not systematicchi2(12) = (b-B)(V_b-V_B)(-1)(b-B)= 7.32Probchi2 = 0.8355(V_b-V_B is not positive definite) LR_ sY9 s ( “14Menial)i|1TGQ imFullmRistbhausman 7 HF alleqV P Z9T/_d9 ( f / PBZ9T) constantV /d9 V91c 9bKTV chi2(12)=
33、7.327Mp0.8355 E Menial F4L !b“ZE(M 7if occ!=1 V) VGQ_ FY IIAL !b HYVMF(base()V_F IIAL!bV Pmlogtest 7Fhausman VZL A N T 7 /. qui mlogit occ ed exper white. mlogtest, hausman base* Hausman tests of IIA assumption (N=337)Ho: Odds(Outcome-J vs Outcome-K) are independent of other alternatives.Omitted chi
34、2 df Pchi2 evidenceMenial 7.324 12 0.835 for HoBlueCol 0.320 12 1.000 for HoCraft -14.436 12 - -WhiteCol -5.541 11 - -Prof -0.119 12 - -Note: If chi2chi2 evidenceMenial -173.287 -166.950 12.675 12 0.393 for HoBlueCol -154.895 -150.543 8.705 12 0.728 for HoCraft -133.658 -130.611 6.095 12 0.911 for HoWhiteCol -152.900 -148.357 9.086 12 0.696 for HoProf -147.905 -143.438 8.933 12 0.709 for Ho CTN -Hausman_ BbSmall-Hsiao_Q_V“ sFyN Qmlogtest,smhsiao 7T t f / . ? 3MbX1 Q