分位数非线性系数的图演变:可以用grqreg来完成吗?其他选择?

Graph evolution of quantile non-linear coefficient: can it be done with grqreg? Other options?

我有以下型号:

Y_{it} = alpha_i + B1*weight_{it} + B2*Dummy_Foreign_{i} + B3*(weight*Dummy_Foreign) _ {it} + e_{it}

我对外国汽车重量对 Y 的影响感兴趣,并绘制相关系数跨分位数的演变图,以及相应的标准误差。也就是说,我需要查看系数 (B1+ B3) 的演变。我知道这是一个非线性效应,需要某种增量方法来获得方差-协方差矩阵以获得 (B1+B3) 的标准误差。

在我深入编写尝试执行此操作的程序之前,我想我会尝试询问是否有使用 grqreg 执行此操作的方法。如果 grqreg 无法做到这一点,请有人指导我如何开始编写代码来计算正确的标准误差,并绘制分位数系数图。

有关我正在尝试做的横截面示例,请参阅下面的代码。

  1. 我使用 grqred 生成单独系数的演变(但我需要联合系数)-- (B1+B3) 及其各自标准误差的演变图。

谢谢。

(我在 Windows 10 上使用 Stata 14.1):

clear
sysuse auto
set scheme s1color

gen gptm = 1000/mpg
label var gptm "gallons / 1000 miles"

gen weight_foreign= weight*foreign
label var weight_foreign "Interaction weight and foreign car"

qreg gptm weight foreign weight_foreign , q(.5) 
grqreg  weight weight_foreign , ci ols olsci reps(40)  

*** Question 1: How to constuct the plot of the coefficient of interest?

你的第二个问题在这里是题外话,因为它是统计性的。试试 CV SE 网站或 Statalist。

以下是您可能如何在横截面中使用 marginsmarginsplot 执行 (1):

clear
set more off
sysuse auto
set scheme s1color
gen gptm = 1000/mpg
label var gptm "gallons / 1000 miles"
sqreg gptm c.weight##i.foreign, q(10 25 50 75 95) reps(500) coefl
margins, dydx(weight) predict(outcome(q10)) predict(outcome(q25)) predict(outcome(q50)) predict(outcome(q75)) predict(outcome(q95)) at(foreign=(0 1)) 
marginsplot, xdimension(_predict) xtitle("Quantile") ///
legend(label(1 "Domestic") label(2 "Foreign")) ///
xlabel(none) xlabel(1 "Q10" 2 "Q25" 3 "Q50" 4 "Q75" 5 "Q95", add) ///
title("Marginal Effect of Weight By Origin") ///
ytitle("GPTM")

这会生成如下图:

我没有在此处重铸 CI,因为它看起来会很混乱,但那样会使它看起来更像您的图表。只需在选项中添加 recastci(rarea)

不幸的是, 面板 分位数回归命令的 none 与因子变量和 margins 配合得很好。但我们可以一起破解一些东西。首先,您可以使用 nlcom 计算系数之和(而不是更自然的 lincom,它缺少 post 选项),存储它们,然后使用 Ben Jann 的 coefplot绘制它们。这是一个玩具示例,可以为您提供主要思路,我们将在其中查看工会成员的任期影响:

set more off
estimates clear
webuse nlswork, clear
gen tXu = tenure*union
local quantiles 1 5 10 25 50 75 90 95 99    // K quantiles that you care about
local models ""                             // names of K quantile models for coefplot to graph 
local xlabel ""                             // for x-axis labels
local j=1                                   // counter for quantiles
foreach q of numlist `quantiles' {
    qregpd ln_wage tenure union tXu, id(idcode) fix(year) quantile(`q')
    nlcom (me_tu:_b[tenure]+_b[tXu]), post
    estimates store me_tu`q'
    local models `"`models' me_tu`q' || "'
    local xlabel `"`xlabel' `j++' "Q{sub:`q'}""'
}
di "`models'
di `"`xlabel'"'
coefplot `models' /// 
, vertical bycoefs rescale(100) ///
xlab(none) xlabel(`xlabel', add) ///
title("Marginal Effect of Tenure for Union Members On Each Conditional Quantile Q{sub:{&tau}}", size(medsmall)) ///
ytitle("Wage Change in Percent" "") yline(0) ciopts(recast(rcap))

这是一条单峰骆驼曲线,表明任期对工资分布中间的影响大于尾部: