分位数方法之所以被广泛使用,关键取决于快速算法的存在。尽管在算法上目前已有很多改进,但计算时间仍然是不可忽略的。本文主要向大家介绍一种分位数回归命令 qrprocess,这一命令与 Stata 官方命令 qreg 的估计结果相近,但运算速度约为前者的 30 倍。
引述一段 Chernozhukov, V., I. Fernández-Val, and B. Melly. 2020a. Fast algorithms for the quantile regression process. Working paper. -PDF- 在结论部分的观点:
Instead of bootstrapping the quantile regression estimates, it is possible
to bootstrap the score (or estimating equation) of the estimator. This approach amounts in fact to using the one-step estimator to compute the bootstrap estimate when we take the sample estimate as a preliminary guess.
This inference procedure, which has been suggested for quantile regression
by Chernozhukov and Hansen (2006) and Belloni et al. (2017), is extremely
fast and can also be used to perform uniform inference. Its drawback is the
necessity to choose a smoothing parameter to estimate the conditional density
of the response variable given the covariates.
The simulations we report in Section 6 show that the preprocessing algorithm is 30 times faster than Stata’s built-in algorithm when we have 50, 000
observations, 20 regressors and we estimate 99 quantile regressions. The onestep estimator further divides the computing time by almost 4. The preprocessing step applied to the bootstrap of a single quantile regression divides the
computing time by about 10. The score multiplier bootstrap further divides
the computing time by 10 compared to the preprocessing algorithm. Thus,
these new algorithms open new possibilities for quantile regression methods.
For instance, in the application reported in Section 7, we could estimate 91
different quantile regressions in a sample of 2, 194, 021 observations, with 14
regressors and bootstrap 100 times the estimates in about 30 minutes on a
laptop. The same estimation with the built-in commands of Stata would take
over two months. The codes in Stata and some rudimentary codes in R are
available from the authors.
2. qrprocess 命令介绍
2.1 理论介绍
令 为 的随机样本,Bassett and Koenker (1978) 的分位数回归估计量为:
其中, 为系数向量, 为线性损失函数,对 ,。此公式为最基础的公式,当然还存在一系列的改进模型,如 Chernozhukov, Fernández-Val and Melly (2020a) 提供了新的算法,有关 Stata 命令的更多详细信息请参照 Fernández-Val and Melly (2020b)。
2.2 安装与语法结构
qrprocess 命令是 Chernozhukov, Fernández-Val and Melly (2020) 编写的 Stata 新命令,安装命令如下:
. ssc install qrprocess, replace
该命令依赖于 moremata,需预先安装:
. ssc install moremata, replace
如果无法直接安装,可以使用如下推文中介绍的手动安装方法:
moremata 程序包手动安装方法
亦可直接执行如下命令:
. net install moremata, from(https://file./StataCMD/moremata) replace force
关于 qrprocess 的基本介绍在这里就结束了,想要深入了解的学者可以阅读下方的参考资料,或者 help qrprocess 查看相关命令的应用与介绍。
5. 参考资料
Angrist J, Chernozhukov V, Fern´andez-Val I (2006) Quantile regression under
misspecification, with an application to the us wage structure. Econometrica
74: 539–563. -PDF-
Bassett, Gilbert, and Roger Koenker. 1978. “Asymptotic Theory of Least Absolute Error Regression.” Journal of the American Statistical Association 73 (363): 618–22. -PDF-
Chernozhukov, V., I. Fernández-Val, and B. Melly. 2020a. Fast algorithms for the quantile regression process. Working paper. -PDF-
Chernozhukov, V., I. Fernández-Val, and B. Melly. 2020b. Quantile and distribution regression in Stata: algorithms, pointwise and functional inference. Working paper.
Chernozhukov V, Hansen C (2006) Instrumental quantile regression inference
for structural and treatment effect models. Journal of Econometrics 132:491–
-PDF-
Koenker R (2005) Quantile Regression. Cambridge University Press. -Link-PDF-, 有权限的用户可以在线阅读