全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
1426 3
2016-09-17
请问各位老师,做logit回归时,如果有一个自变量是分类变量,
比如“步行,公交,地铁,开车”,在stata中该如何处理呢?
谢谢!!

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2016-9-17 15:46:13
你的情況應該用 mlogit — Multinomial (polytomous) logistic regression,請 help mlogit 並見其說明!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-9-17 21:36:40
黃河泉 发表于 2016-9-17 15:46
你的情況應該用 mlogit — Multinomial (polytomous) logistic regression,請 help mlogit 並見其說明!
谢谢老师!
实践了一下,结果如下(贴在问题后面了):
1. 我的理解是 insure 和 site 都是分类变量?对吗?
2. 请问,“  i.site” 这一项,为什么要加一个“i” 呢?有什么意义呢?
3. stata自动把 Indemnity 作为虚拟变量了?把Indemnity和 Prepaid、 Uninsure   分别做了比较,但没有比较 Prepaid、 Uninsure之间?
4. 如果我还想比较Prepaid、 Uninsure之间的差异,该如何做呢?
谢谢老师!!!

. help mlogit

. webuse sysdsn1
(Health insurance data)

. sum

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
       patid |       644    592838.1    315023.2       3292     997539
    noinsur0 |       338    .0710059    .2572155          0          1
    noinsur1 |       339    .0707965    .2568637          0          1
    noinsur2 |       336    .0535714    .2255058          0          1
         age |       643    44.41415    14.22441   18.11087   86.07254
-------------+--------------------------------------------------------
        male |       644    .2593168    .4386004          0          1
        ppd0 |       644    .4751553    .4997705          0          1
        ppd1 |       644    .4736025    .4996908          0          1
        ppd2 |       616    .4545455    .4983343          0          1
    nonwhite |       644    .1956522    .3970103          0          1
-------------+--------------------------------------------------------
         ppd |       644    .4736025    .4996908          0          1
      insure |       616    1.595779    .6225427          1          3
        site |       644    1.987578    .7964742          1          3

. mlogit insure age male nonwhite i.site

Iteration 0:   log likelihood = -555.85446  
Iteration 1:   log likelihood = -534.67443  
Iteration 2:   log likelihood = -534.36284  
Iteration 3:   log likelihood = -534.36165  
Iteration 4:   log likelihood = -534.36165  

Multinomial logistic regression                   Number of obs   =        615
                                                  LR chi2(10)     =      42.99
                                                  Prob > chi2     =     0.0000
Log likelihood = -534.36165                       Pseudo R2       =     0.0387

------------------------------------------------------------------------------
      insure |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
Indemnity    |  (base outcome)
-------------+----------------------------------------------------------------
Prepaid      |
         age |   -.011745   .0061946    -1.90   0.058    -.0238862    .0003962
        male |   .5616934   .2027465     2.77   0.006     .1643175    .9590693
    nonwhite |   .9747768   .2363213     4.12   0.000     .5115955    1.437958
             |
        site |
          2  |   .1130359   .2101903     0.54   0.591    -.2989296    .5250013
          3  |  -.5879879   .2279351    -2.58   0.010    -1.034733   -.1412433
             |
       _cons |   .2697127   .3284422     0.82   0.412    -.3740222    .9134476
-------------+----------------------------------------------------------------
Uninsure     |
         age |  -.0077961   .0114418    -0.68   0.496    -.0302217    .0146294
        male |   .4518496   .3674867     1.23   0.219     -.268411     1.17211
    nonwhite |   .2170589   .4256361     0.51   0.610    -.6171725     1.05129
             |
        site |
          2  |  -1.211563   .4705127    -2.57   0.010    -2.133751   -.2893747
          3  |  -.2078123   .3662926    -0.57   0.570    -.9257327     .510108
             |
       _cons |  -1.286943   .5923219    -2.17   0.030    -2.447872   -.1260134
------------------------------------------------------------------------------

.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-9-17 21:38:40
黃河泉 发表于 2016-9-17 15:46
你的情況應該用 mlogit — Multinomial (polytomous) logistic regression,請 help mlogit 並見其說明!
还有就是。。。
Iteration 0:   log likelihood = -555.85446  
Iteration 1:   log likelihood = -534.67443  
Iteration 2:   log likelihood = -534.36284  
Iteration 3:   log likelihood = -534.36165  
Iteration 4:   log likelihood = -534.36165
这为什么会有5个?。。。。如何理解呢?
谢谢老师!麻烦您了!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群