Stata如何绘制分位数回归图?

巴德学院利维经济研究所的Fernando Rios-Avila开发了Stata社区命令qregplot,以图展现绘制分位数回归的回归系数。

安装Stata社区命令qregplot的Stata命令如下:


ssc install qregplot, replace
*安装依赖的Stata社区命令
ssc install mmqreg, replace
ssc install qrprocess, replace
ssc install ivqreg2, replace
ssc install qreg2, replace
ssc install xtqreg, replace
ssc install color_style

数据准备,Stata代码如下:


webuse womenwk, clear
set scheme white

绘制上图的Stata代码如下:


qregplot age education married , /// Variables to be plotted
from(e_qreg) /// Request Storing the variables in memory
col(2)   /// and different sizes for the graph
mtitles("Age in years o Edad en años desde 1900" ///
"Años de Educacion or Years of Education, incluye Highschool" ///
"Is Married - Esta Casado") ///<- ads long titles
labelopt(lines(2)) // breaks it in two lines


绘制上图的Stata代码如下:


bsqreg wage age education married i.county, reps(25)
color_style bay, select(1)
qregplot age education ,  q(5(5)95) seed(101) label title("BSqreg") ///
ysize(4) xsize(7)


绘制上图的Stata代码如下:


qreg2 wage age education married i.county, 
color_style bay, select(2)
qregplot age education , ///
 q(5(5)95) seed(101) label ///
 title("QREG2: from SSC") ///
ysize(4) xsize(7)


绘制上图的Stata代码如下:


qrprocess wage age education married i.county, 
color_style bay, select(3)
qregplot age education ,  ///
q(5(5)95) seed(101) label ///
title("qrprocess: from SSC") ///
ysize(4) xsize(7)


绘制上图的Stata代码如下:


mmqreg wage age education married, abs( county)
color_style bay, select(4)
qregplot age education ,  q(5(5)95) seed(101) label title("mmqreg: from SSC") ///
ysize(4) xsize(7)


绘制上图的Stata代码如下:


rifhdreg wage age education married, abs( county) rif(q(50))
color_style bay, select(5)
qregplot age education ,  q(5(5)95) seed(101) label title("rifhdreg: from SSC") ///
ysize(4) xsize(7)