1

假设我想使用 R 中的在线数据集做一个简单的多项式 logit 模型:

library(nnet)
data <- data.table(read.dta('http://data.princeton.edu/wws509/datasets/irished.dta'))
ml <- multinom(educg ~ gender + prestigeg + reasong, data=data)
summary(ml)

你得到以下输出

摘要(ml)调用:multinom(公式= educg〜性别+声望+推理,数据=数据)

Coefficients:
          (Intercept) genderfemale prestigegQ2 prestigegQ3 prestigegQ4   reasongQ2 reasongQ3 reasongQ4
senior      -1.650999    0.3051297   0.8704957    1.189714    1.340206 -0.08303942  1.035163  1.627145
3rd level   -5.792979    0.1615402   1.5331076    1.682500    2.227006  2.11053104  3.232968  4.963707

Std. Errors:
          (Intercept) genderfemale prestigegQ2 prestigegQ3 prestigegQ4 reasongQ2 reasongQ3 reasongQ4
senior      0.3203241    0.2304163   0.3023462   0.3376034   0.3288158 0.2990188 0.3063954 0.3488479
3rd level   1.1165939    0.3477700   0.5534933   0.5878517   0.5433370 1.0789145 1.0644124 1.0532858

Residual Deviance: 730.8832 
AIC: 762.8832 

如果我在 Stata 中执行类似的例程:

use http://data.princeton.edu/wws509/datasets/irished.dta
mlogit educg gender prestigeg reasong

我得到以下输出:

Iteration 0:   log likelihood = -433.16499  
Iteration 1:   log likelihood = -376.86517  
Iteration 2:   log likelihood = -371.52279  
Iteration 3:   log likelihood = -371.42355  
Iteration 4:   log likelihood = -371.42343  
Iteration 5:   log likelihood = -371.42343  

Multinomial logistic regression                 Number of obs     =        435
                                                LR chi2(6)        =     123.48
                                                Prob > chi2       =     0.0000
Log likelihood = -371.42343                     Pseudo R2         =     0.1425

------------------------------------------------------------------------------
       educg |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
junior       |  (base outcome)
-------------+----------------------------------------------------------------
senior       |
      gender |   .2577712   .2247087     1.15   0.251    -.1826498    .6981921
   prestigeg |   .4394042   .1027884     4.27   0.000     .2379427    .6408657
     reasong |   .5584275   .1059711     5.27   0.000     .3507279     .766127
       _cons |  -2.890597    .533933    -5.41   0.000    -3.937086   -1.844108
-------------+----------------------------------------------------------------
3rd_level    |
      gender |   .1360704   .3416126     0.40   0.690    -.5334779    .8056188
   prestigeg |   .6387618   .1532933     4.17   0.000     .3383125    .9392111
     reasong |   1.431763    .197151     7.26   0.000     1.045355    1.818172
       _cons |  -7.032375   .9904472    -7.10   0.000    -8.973616   -5.091134
------------------------------------------------------------------------------

为什么这些价值观完全不同?如何在 R 中为多项 logit 模型获得类似 Stata 的输出?

4

0 回答 0