我正在使用Stata中的几种回归(probit,logit,quantile regression,...)我想知道如何在回归量的样本均值上预测因变量。这对于OLS来说很简单,但是没有看到如何将它用于分位数回归。
答案 0 :(得分:1)
margins
命令对此非常有用:
. sysuse auto
(1978 Automobile Data)
. qreg price weight length i.foreign, nolog
Median regression Number of obs = 74
Raw sum of deviations 71102.5 (about 4934)
Min sum of deviations 54411.29 Pseudo R2 = 0.2347
------------------------------------------------------------------------------
price | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
weight | 3.933588 1.328718 2.96 0.004 1.283543 6.583632
length | -41.25191 45.46469 -0.91 0.367 -131.9284 49.42456
|
foreign |
Foreign | 3377.771 885.4198 3.81 0.000 1611.857 5143.685
_cons | 344.6489 5182.394 0.07 0.947 -9991.31 10680.61
------------------------------------------------------------------------------
. margins, at((mean) _continuous (base) _factor)
Warning: cannot perform check for estimable functions.
Adjusted predictions Number of obs = 74
Model VCE : IID
Expression : Linear prediction, predict()
at : weight = 3019.459 (mean)
length = 187.9324 (mean)
foreign = 0
------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_cons | 4469.386 418.7774 10.67 0.000 3648.597 5290.175
这预测了连续变量的协变量的中位数和假人的基数(因此你可以避免像分数怀孕这样的无意义的值)。