使用 mlogit(R 包)估计多项概率模型

机器算法验证 r 多项分布 罗吉特 概率
2022-04-07 20:36:09

从文档和帮助来看,mlogit 支持 probit 模型。但是当我用这些 R 脚本尝试它时,估计需要更长的时间来运行(比 logit 版本),结果也有很大不同(参数 probit=FALSE)。probit 的行为是否正确?如果是这样,我应该如何解释 er.gc、er.gr 等系数?

> require(mlogit)
> data(Heating)
> H <- mlogit.data(Heating, shape="wide", choice="depvar", varying=c(3:12))
> m1.probit = mlogit(depvar~ic+oc, H, probit=TRUE)
> summary(m1.probit)

Call:
mlogit(formula = depvar ~ ic + oc, data = H, probit = TRUE)

Frequencies of alternatives:
      ec       er       gc       gr       hp 
0.071111 0.093333 0.636667 0.143333 0.055556 

bfgs method
37 iterations, 0h:4m:54s 
g'(-H)^-1g = 0.011 
last step couldn't find higher value 

Coefficients :
                  Estimate  Std. Error t-value Pr(>|t|)  
er:(intercept)  2.5611e-01  3.6641e-01  0.6990  0.48457  
gc:(intercept) -2.6944e-02  3.3211e-01 -0.0811  0.93534  
gr:(intercept) -1.8439e+01  3.2798e+01 -0.5622  0.57398  
hp:(intercept) -6.4231e-01  7.4214e-01 -0.8655  0.38677  
ic             -1.1447e-03  5.3175e-04 -2.1528  0.03133 *
oc             -3.3779e-03  1.4011e-03 -2.4109  0.01591 *
er.gc           4.4987e-01  2.6880e-01  1.6736  0.09421 .
er.gr           5.8580e+00  1.1236e+01  0.5214  0.60212  
er.hp           1.2613e+00  5.0231e-01  2.5109  0.01204 *
gc.gc           7.1013e-01  3.5489e-01  2.0010  0.04540 *
gc.gr          -8.4606e+00  1.6848e+01 -0.5022  0.61555  
gc.hp           6.7245e-01  6.1475e-01  1.0939  0.27401  
gr.gr           1.4085e+01  2.6034e+01  0.5410  0.58849  
gr.hp           4.9476e-01  4.4568e-01  1.1101  0.26694  
hp.hp           2.2620e-01  2.9062e-01  0.7783  0.43637  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Log-Likelihood: -1000.1
McFadden R^2:  0.021626 
Likelihood ratio test : chisq = 44.213 (p.value = 1.4049e-05)

> m1.logit = mlogit(depvar~ic+oc, H, probit=FALSE)
> summary(m1.logit)

Call:
mlogit(formula = depvar ~ ic + oc, data = H, probit = FALSE, 
    method = "nr", print.level = 0)

Frequencies of alternatives:
      ec       er       gc       gr       hp 
0.071111 0.093333 0.636667 0.143333 0.055556 

nr method
6 iterations, 0h:0m:0s 
g'(-H)^-1g = 9.58E-06 
successive function values within tolerance limits 

Coefficients :
                  Estimate  Std. Error t-value  Pr(>|t|)    
er:(intercept)  0.19459102  0.20424212  0.9527 0.3407184    
gc:(intercept)  0.05213336  0.46598878  0.1119 0.9109210    
gr:(intercept) -1.35058266  0.50715442 -2.6631 0.0077434 ** 
hp:(intercept) -1.65884594  0.44841936 -3.6993 0.0002162 ***
ic             -0.00153315  0.00062086 -2.4694 0.0135333 *  
oc             -0.00699637  0.00155408 -4.5019 6.734e-06 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Log-Likelihood: -1008.2
McFadden R^2:  0.013691 
Likelihood ratio test : chisq = 27.99 (p.value = 8.3572e-07)
2个回答

Probit 模型通常需要更长的时间来拟合,因为似然函数是通过模拟或求积计算的。logit 似然有一个封闭形式的解决方案,使其速度更快。

此外,Probit 似然函数不是全局凸的,因此该算法可以收敛到局部最大值。您需要尝试不同的起始值。

最后,系数应该相同,因为它们使用不同的尺度参数。

一般来说,如果没有真正令人信服的理由来使用 Probit,最好还是远离。

与运行probit=TRUE并没有收敛到一个好的答案。查看输出中以“最后一步找不到更高值”开头的行,并比较 logit 模型输出中的相同部分。拟合概率模型需要这么长时间的另一个原因是该软件正在使用模拟逼近高维积分(参见 mlogit 的小插图,第 54 页)。有时重新调整协变量可以帮助解决数值困难,但这里不是这样,我试过了

HS$ic <- scale(H$ic)
HS$oc <- scale(H$oc)

m2.probit = mlogit(depvar~ic+oc, HS, probit=TRUE)

并且遇到了同样的困难。我会对概率模型的结果持一定程度的怀疑态度。特别是,概率模型中的结果“gr”发生了一些有趣的事情(参见截距和方差参数估计)。

摘要中标记为 er.gc、er.gr 等的系数是作为概率模型的一部分估计的方差-协方差矩阵的参数。