我正在比较穆迪和S& P的信用评级决定因素的权重。 然后,进行生物定位分析的目的是测试穆迪和S& P之间的β系数是否相同。 我想基于Wald测试做到这一点,但我需要Beta的协方差矩阵。你能帮我解决一下Stata如何得到协方差矩阵的代码吗?
进入模型的变量是S& Prat Mrat GDP通胀率等
提前致谢
答案 0 :(得分:2)
基于@Nick Cox:
来自Stata data
的示例(您需要安装bioprobit
这是用户编写的命令)
sysuse auto
bioprobit headroom foreign price length mpg turn
. bioprobit headroom foreign price length mpg turn
group(forei |
gn) | Freq. Percent Cum.
------------+-----------------------------------
1 | 52 70.27 70.27
2 | 22 29.73 100.00
------------+-----------------------------------
Total | 74 100.00
initial: log likelihood = -148.5818
rescale: log likelihood = -148.5818
rescale eq: log likelihood = -147.44136
Iteration 0: log likelihood = -147.44136
Iteration 1: log likelihood = -147.43958
Iteration 2: log likelihood = -147.43958
Bivariate ordered probit regression Number of obs = 74
Wald chi2(4) = 22.61
Log likelihood = -147.43958 Prob > chi2 = 0.0002
------------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
headroom |
price | -.0000664 .0000478 -1.39 0.164 -.00016 .0000272
length | .0347597 .013096 2.65 0.008 .009092 .0604274
mpg | -.0118916 .0354387 -0.34 0.737 -.0813502 .0575669
turn | -.0333833 .0554614 -0.60 0.547 -.1420857 .0753191
-------------+----------------------------------------------------------------
foreign |
price | .0003981 .0001485 2.68 0.007 .0001071 .0006892
length | -.0585548 .0284639 -2.06 0.040 -.114343 -.0027666
mpg | -.0306867 .0543826 -0.56 0.573 -.1372745 .0759012
turn | -.3471526 .1321667 -2.63 0.009 -.6061946 -.0881106
-------------+----------------------------------------------------------------
athrho |
_cons | .053797 .3131717 0.17 0.864 -.5600082 .6676022
-------------+----------------------------------------------------------------
/cut11 | 2.72507 2.451108 -2.079014 7.529154
/cut12 | 3.640296 2.445186 -1.152181 8.432772
/cut13 | 4.227321 2.443236 -.561334 9.015975
/cut14 | 4.792874 2.452694 -.0143182 9.600067
/cut15 | 5.586825 2.480339 .7254488 10.4482
/cut16 | 6.381491 2.505192 1.471404 11.29158
/cut17 | 7.145783 2.529663 2.187735 12.10383
/cut21 | -21.05768 6.50279 -33.80292 -8.312449
-------------+----------------------------------------------------------------
rho | .0537452 .3122671 -.5079835 .5834004
------------------------------------------------------------------------------
LR test of indep. eqns. : chi2(1) = 0.03 Prob > chi2 = 0.8636
# results that are in `Stata's memory`
ereturn list
scalars:
e(rc) = 0
e(ll) = -147.4395814769408
e(converged) = 1
e(rank) = 17
e(k) = 17
e(k_eq) = 11
e(k_dv) = 2
e(ic) = 2
e(N) = 74
e(k_eq_model) = 1
e(df_m) = 4
e(chi2) = 22.60944901065799
e(p) = .0001515278365065
e(ll_0) = -147.4543291018424
e(k_aux) = 8
e(chi2_c) = .0294952498030625
e(p_c) = .8636405133599019
macros:
e(chi2_ct) : "LR"
e(depvar) : "headroom foreign"
e(predict) : "bioprobit_p"
e(cmd) : "bioprobit"
e(chi2type) : "Wald"
e(vce) : "oim"
e(opt) : "ml"
e(title) : "Bivariate ordered probit regression"
e(ml_method) : "d2"
e(user) : "bioprobit_d2"
e(crittype) : "log likelihood"
e(technique) : "nr"
e(properties) : "b V"
matrices:
e(b) : 1 x 17
e(V) : 17 x 17
e(gradient) : 1 x 17
e(ilog) : 1 x 20
functions:
e(sample)
#You need to use mat list e(V) to display the variance covariance matrix
mat list e(V)
symmetric e(V)[17,17]
headroom: headroom: headroom: headroom: foreign: foreign: foreign: foreign:
price length mpg turn price length mpg turn
headroom:price 2.280e-09
headroom:length -1.431e-07 .00017151
headroom:mpg 3.991e-07 .00018914 .0012559
headroom:turn 4.426e-07 -.00050302 .00027186 .00307597
foreign:price 1.124e-10 -4.999e-09 2.093e-08 2.079e-08 2.205e-08
foreign:length -5.846e-09 8.021e-06 9.950e-06 -.0000249 -2.087e-06 .00081019
foreign:mpg 1.712e-08 .00001035 .00006387 .00001352 1.254e-06 .0006546 .00295746
foreign:turn 1.145e-08 -.00002418 .00001022 .00015562 -.00001083 -.00028103 -.0001411 .01746805
athrho:_cons 2.360e-07 -.00004531 .0000684 .00005575 -2.010e-06 .00043717 -.00147713 -.00449239
cut11:_cons .0000134 .01507955 .07578798 .03653671 1.039e-06 .00068972 .00401168 .00211706
cut12:_cons .00001374 .01514192 .07570527 .03630636 9.488e-07 .0007133 .00386727 .00165474
cut13:_cons .00001393 .01520261 .07550433 .03603257 9.668e-07 .0007088 .00386171 .00165557
cut14:_cons .00001363 .01539981 .07532214 .03582323 1.042e-06 .00068687 .00392914 .00189195
cut15:_cons .00001264 .01584186 .07541396 .03541453 1.101e-06 .00068091 .0040106 .00209853
cut16:_cons .00001148 .01611862 .07562328 .03535426 1.052e-06 .00069849 .00401805 .00206701
cut17:_cons .00001055 .01602514 .07547739 .03620485 9.866e-07 .00069868 .00399718 .00207143
cut21:_cons 4.412e-07 .00073781 .00377201 .00190456 -.00058242 .13231539 .18778679 .51179829
athrho: cut11: cut12: cut13: cut14: cut15: cut16: cut17:
_cons _cons _cons _cons _cons _cons _cons _cons
athrho:_cons .09807649
cut11:_cons -.0064343 6.0079319
cut12:_cons .00229188 5.9652808 5.9789347
cut13:_cons .00187855 5.9546524 5.9639617 5.9694026
cut14:_cons -.00310632 5.9724552 5.9793328 5.9820512 6.0157096
cut15:_cons -.00783593 6.0300908 6.03522 6.0360956 6.0667389 6.1520838
cut16:_cons -.00756313 6.0745198 6.0789515 6.0788816 6.1081885 6.1880183 6.275988
cut17:_cons -.00673882 6.0811477 6.0851101 6.0844209 6.1128719 6.1897756 6.2679698 6.3991936
cut21:_cons -.13478036 .30582954 .28918756 .28844026 .29527602 .30401845 .30575462 .30503648
cut21:
_cons
cut21:_cons 42.286275
# If you want to use variance covariance matrix of first four variables
mat kk=e(V)
mat kkk=kk[1..4,1..4]
mat list kkk
symmetric kkk[4,4]
headroom: headroom: headroom: headroom:
price length mpg turn
headroom:price 2.280e-09
headroom:length -1.431e-07 .00017151
headroom:mpg 3.991e-07 .00018914 .0012559
headroom:turn 4.426e-07 -.00050302 .00027186 .00307597