STATA2.0IIc2007–2010STATALogistic115.1.............................................115.2Logit.......................................115.2.1......................................115.2.2Logit.....................................215.2.3Logistic....................................215.2.4........................................315.2.5.....................................615.2.6..............................715.3Logit......................................1215.3.1........................................1215.3.2......................................1815.3.3......................................2715.3.4....................................2815.4STATALogitech........................33IIILogistic15.1logisticlogistic(binary)(dichotomous)logisticlogistic15.2Logit15.2.1yiyi01yiD(1i0(15-1)yiYiYi10i1 iYi(Bernoulli)iPrYiDyiDyii.1 i/1 yi;yiD0;1:(15-2)yiD1iyiD01 iYiE.Yi/DiDiVar.Yi/DiDi.1 i/115.2LOGIT2i15.2.2LogitixiiDx0i,i01logitixii(odds)iDi1 i;(15-4)yiD1iyiD0(1 i)logitlog-oddslogit.i/Dln.i/Dlni1 i(15-5)i0logit 1i1logitC1logiti(0,1)0.51logit0logit0.50.515-115.2.3LogisticLogisticiLogit(i)logit.i/Dlni1 iDx0i;(15-6)xiLOGISTIC3020406080100Odds0.2.4.6.81Probability0.2.4.6.81Probability−4−2024Logit(log−odds)15-1:logitlogitLogit(antilogit)(15-6).xi/Dexp.x0i/1Cexp.x0i/:(15-7)yiD.xi/Ci:(15-8)iyiD1iD1 .xi/.xi/yiD0iD .xi/1 .xi/0.xi/[1 .xi/](1)01(15-5)logit(2)(3)logit15.2.4logit(MLE)(15-7)xYD1.xi/P.YD1jx/1 .x/xYD0i.xi/yi[1 .xi/]1 yi:(15-9)15.2LOGIT4L./DnYiD1.xi/yi[1 .xi/]1 yi:(15-10)(15-10)OlnL./DnXiD1nyiln[.xi/]C.1 yi/ln[1 .xi/]o(15-11)@lnL./@DnXiD1.yi i/xiD0:(15-12)(15-12)(1)xiNOiDNyiyiD1(2)yi i(generalizedresidual)(15-12)H./D @2lnL@@0D nXiD1i.1 i/xix0i:(15-13)H(Hessian)Hessian-HessianVar./D H 1./:(15-14)jVar.j/OjCov.j;l/OjOl-Var.O/Var.Oj/Cov.Oj;Ol/j;lD0;1;2;;kse.Oj/DqVar.Oj/;forjD0;1;2;;k:(15-15)StataLogit(MLE)MLMLLong(1997,p.54)1.100ML500LOGISTIC52.103.(1)4.(ordinalregressionmodelzero-inflatedcountmodel)StataMLE11,000ExampleStatalogitlogitStataauto.dta(=1=0).sysuseauto,clear(1978AutomobileData).logitforeignweimpgIteration0:loglikelihood=-45.03321Iteration1:loglikelihood=-29.898968Iteration2:loglikelihood=-27.495771Iteration3:loglikelihood=-27.184006Iteration4:loglikelihood=-27.175166Iteration5:loglikelihood=-27.175156LogisticregressionNumberofobs=74LRchi2(2)=35.72Probchi2=0.0000Loglikelihood=-27.175156PseudoR2=0.3966foreignCoef.Std.Err.zP|z|[95%Conf.Interval]weight-.0039067.0010116-3.860.000-.0058894-.001924mpg-.1685869.0919174-1.830.067-.3487418.011568_cons13.708374.5187073.030.0024.85186422.56487foeign,(01)11StatayiD0(negativeoutcomes)()(positiveoutcomes)0/115.2LOGIT6weightmpg5MLEStata(Numberofobs=74)(Loglikelihood=-27.18)(Coef.)(Std.Err.)zp95%15.2.5MLEH0:jD0z zjDOjse.Oj/:45zpweight1%testlrtestWald(LRtest)Wald(LRtest)StatatestlrtestExampleWald:weightmpg.testweightmpg(1)weight=0(2)mpg=0chi2(2)=17.78Probchi2=0.0001weightmpg1%LR:2:GD 2[lnOLC lnOLNC]2.p/2LR:(1)(nested);(2)LOGISTIC7lnLClnLNCpH0:weightDmpgD0pD2LRStata.quilogitforeign.eststorelogit0.quilogitforeignweimpg.eststorelogitfull.lrtestlogitfulllogit0Likelihood-ratiotestLRchi2(2)=35.72(Assumption:logit0nestedinlogitfull)Probchi2=0.0000(LRchi2(2)=35.72)5logittestlrtest15.2.6(15-6)jjlogitjln.i/j(15-6)iiDexp.x0i/:(15-16)j1i.xi;xijC1/Dexp.x0i/exp.j/(15-17)(15-16)(15-17)(oddsratio)3.x;xjC1/.x;xj/Dexp.j/(15-18)exp.j/xj(odds)exp.j/exp.j/1exp.j/;exp.j/1exp.j/xjxjexp.jsj/3(15-18)i15.2LOGIT8Examplelogitor.logitforeignweimpgprice,ornologLogisticregressionNumberofobs=74LRchi2(3)=55.74Probchi2=0.0000Loglikelihood=-17.161893PseudoR2=0.6189foreignOddsRatioStd.Err.zP|z|[95%Conf.Interval]weight.9931737.0019856-3.430.001.9892895.9970731mpg.8859526.0847702-1.270.206.73445541.068699price1.000927.00030763.010.0031.0003241.00153nologStata—logistic.logisticforeignweimpgprice(outputomitted).genprice2=price/1000.logitforeignweimpgprice2,ornologLogisticregressionNumberofobs=74LRchi2(3)=55.74Probchi2=0.0000Loglikelihood=-17.161893PseudoR2=0.6189foreignOddsRatioStd.Err.zP|z|[95%Conf.Interval]weight.9931737.0019859-3.430.001.9892889.9970737mpg.8859526.0847728-1.270.206.7344511.068706price22.525378.77623243.010.0031.382584.612778price2=price/1000price1$price21,000$priceprice21000priceDprice2exp.1000price/Dexp.price2/.disexp(1000*ln(1.000927))2.5258322listcoef44listcoefStatafinditlistcoefLOGISTIC9.quilogitforeignweimpgprice.listcoef,helpconstantlogit(N=74):FactorChangeinOddsOddsof:ForeignvsDomestic------------------------------------------------------------------foreign|bzP|z|eˆbeˆbStdXSDofX---------+--------------------------------------------------------weight|-0.00685-3.4260.0010.99320.0049777.1936mpg|-0.12109-1.2660.2060.88600.49635.7855price|0.000933.0140.0031.000915.36952949.4959_cons|14.422372.6640.008------------------------------------------------------------------b=rawcoefficientz=z-scorefortestofb=0P|z|=p-valueforz-testeˆb=exp