Stata 多项式回归 - post-估计 Wald 检验
Stata multinomial regression - post-estimation Wald test
我在 Stata 中进行了多项逻辑回归分析,然后进行了 Wald 测试,希望有人可以确认我的代码正在做我认为正在做的事情。
注意:我正在使用一些 Stata 的示例数据来说明。我 运行 对此图的分析完全没有意义,但使用与我的 'real' 分析相同的程序,除了我的实际分析还包括一些概率权重和其他协变量这一事实。
sysuse auto.dta
首先,我运行一个多项逻辑回归,从'Foreign'和'Price'预测'Repair Record':
mlogit rep78 i.foreign price, base(1) rrr nolog
Multinomial logistic regression Number of obs = 69
LR chi2(8) = 31.15
Prob > chi2 = 0.0001
Log likelihood = -78.116372 Pseudo R2 = 0.1662
------------------------------------------------------------------------------
rep78 | RRR Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
1 | (base outcome)
-------------+----------------------------------------------------------------
2 |
foreign |
Foreign | .7822853 1672.371 -0.00 1.000 0 .
price | 1.000414 .0007027 0.59 0.556 .9990375 1.001792
_cons | .5000195 1.669979 -0.21 0.836 .000718 348.2204
-------------+----------------------------------------------------------------
3 |
foreign |
Foreign | 686842 1.30e+09 0.01 0.994 0 .
price | 1.000462 .0006955 0.66 0.507 .9990996 1.001826
_cons | 1.254303 4.106511 0.07 0.945 .0020494 767.6863
-------------+----------------------------------------------------------------
4 |
foreign |
Foreign | 6177800 1.17e+10 0.01 0.993 0 .
price | 1.000421 .0006999 0.60 0.547 .9990504 1.001794
_cons | .5379627 1.7848 -0.19 0.852 .0008067 358.7452
-------------+----------------------------------------------------------------
5 |
foreign |
Foreign | 2.79e+07 5.29e+10 0.01 0.993 0 .
price | 1.000386 .0007125 0.54 0.587 .9989911 1.001784
_cons | .146745 .5072292 -0.56 0.579 .0001676 128.4611
------------------------------------------------------------------------------
其次,我想知道结果类别 4 的 'Foreign' 系数是否显着不同于结果类别 5 的 'Foreign' 系数。因此,我 运行 Wald 检验:
test [4]1.foreign = [5]1.foreign
( 1) [4]1.foreign - [5]1.foreign = 0
chi2( 1) = 2.72
Prob > chi2 = 0.0988
据此,我得出结论,结果类别 4 的 'Foreign' 系数与结果类别 5 的 'Foreign' 系数没有显着差异。更简单地说,[=28= 之间的关联]和'Repair 4'(相对于'Repair 1')等于'Foreign'和'Repair 5'之间的关联(相对于'Repair 1')。
我的 Wald 测试代码以及我对它所做和显示的推断是否正确?
此外,对于评论中讨论的内容,您还可以使用以下代码执行似然比检验。
sysuse auto.dta
qui mlogit rep78 i.foreign price, base(1) rrr nolog
estimate store unrestricted
constraint 1 [4]1.foreign = [5]1.foreign
qui mlogit rep78 i.foreign price, base(1) rrr nolog constraints(1)
estimate store restricted
lrtest unrestricted restricted
测试的输出显示与 Wald 测试相同的结论,但它具有更好的属性,如下所述。
Likelihood-ratio test LR chi2(1) = 3.13
(Assumption: restricted nested in unrestricted) Prob > chi2 = 0.0771
引用官方documentation 来自mlogit
The results produced by test
are an approximation based on the estimated covariance matrix of the coefficients. Because the probability of being uninsured is low, the log-likelihood may be nonlinear for the uninsured. Conventional statistical wisdom is not to trust the asymptotic answer under these circumstances but to perform a likelihood-ratio test instead.
我在 Stata 中进行了多项逻辑回归分析,然后进行了 Wald 测试,希望有人可以确认我的代码正在做我认为正在做的事情。
注意:我正在使用一些 Stata 的示例数据来说明。我 运行 对此图的分析完全没有意义,但使用与我的 'real' 分析相同的程序,除了我的实际分析还包括一些概率权重和其他协变量这一事实。
sysuse auto.dta
首先,我运行一个多项逻辑回归,从'Foreign'和'Price'预测'Repair Record':
mlogit rep78 i.foreign price, base(1) rrr nolog
Multinomial logistic regression Number of obs = 69
LR chi2(8) = 31.15
Prob > chi2 = 0.0001
Log likelihood = -78.116372 Pseudo R2 = 0.1662
------------------------------------------------------------------------------
rep78 | RRR Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
1 | (base outcome)
-------------+----------------------------------------------------------------
2 |
foreign |
Foreign | .7822853 1672.371 -0.00 1.000 0 .
price | 1.000414 .0007027 0.59 0.556 .9990375 1.001792
_cons | .5000195 1.669979 -0.21 0.836 .000718 348.2204
-------------+----------------------------------------------------------------
3 |
foreign |
Foreign | 686842 1.30e+09 0.01 0.994 0 .
price | 1.000462 .0006955 0.66 0.507 .9990996 1.001826
_cons | 1.254303 4.106511 0.07 0.945 .0020494 767.6863
-------------+----------------------------------------------------------------
4 |
foreign |
Foreign | 6177800 1.17e+10 0.01 0.993 0 .
price | 1.000421 .0006999 0.60 0.547 .9990504 1.001794
_cons | .5379627 1.7848 -0.19 0.852 .0008067 358.7452
-------------+----------------------------------------------------------------
5 |
foreign |
Foreign | 2.79e+07 5.29e+10 0.01 0.993 0 .
price | 1.000386 .0007125 0.54 0.587 .9989911 1.001784
_cons | .146745 .5072292 -0.56 0.579 .0001676 128.4611
------------------------------------------------------------------------------
其次,我想知道结果类别 4 的 'Foreign' 系数是否显着不同于结果类别 5 的 'Foreign' 系数。因此,我 运行 Wald 检验:
test [4]1.foreign = [5]1.foreign
( 1) [4]1.foreign - [5]1.foreign = 0
chi2( 1) = 2.72
Prob > chi2 = 0.0988
据此,我得出结论,结果类别 4 的 'Foreign' 系数与结果类别 5 的 'Foreign' 系数没有显着差异。更简单地说,[=28= 之间的关联]和'Repair 4'(相对于'Repair 1')等于'Foreign'和'Repair 5'之间的关联(相对于'Repair 1')。
我的 Wald 测试代码以及我对它所做和显示的推断是否正确?
此外,对于评论中讨论的内容,您还可以使用以下代码执行似然比检验。
sysuse auto.dta
qui mlogit rep78 i.foreign price, base(1) rrr nolog
estimate store unrestricted
constraint 1 [4]1.foreign = [5]1.foreign
qui mlogit rep78 i.foreign price, base(1) rrr nolog constraints(1)
estimate store restricted
lrtest unrestricted restricted
测试的输出显示与 Wald 测试相同的结论,但它具有更好的属性,如下所述。
Likelihood-ratio test LR chi2(1) = 3.13
(Assumption: restricted nested in unrestricted) Prob > chi2 = 0.0771
引用官方documentation 来自mlogit
The results produced by
test
are an approximation based on the estimated covariance matrix of the coefficients. Because the probability of being uninsured is low, the log-likelihood may be nonlinear for the uninsured. Conventional statistical wisdom is not to trust the asymptotic answer under these circumstances but to perform a likelihood-ratio test instead.