0
votes

I am trying to run quantile regressions across deciles, and so I use the sqreg command to get bootstrap standard errors for every decile. However, after I run the regression (so Stata runs 9 different regressions - one for each decile except the 100th) I want to store the coefficients in locals. Normally, this is what I would do:

reg y x, r 
local coeff = _b[x]

And things would work well. However, here my command is:

sqreg y x, q(0.1 0.2 0.3)

So, I will have three different coefficients here that I want to store as three different locals. Something like:

local coeff10 = _b[x] //Where _b[x] is the coefficient on x for the 10th quantile.

How do I do this? I tried:

local coeff10 = _b[[q10]x]

But this gives me an error. Please help! Thank you!

1

1 Answers

3
votes

Simply save matrix of coefficients from postestimation scalars and reference the outputted variable by row and column.

The reason you could not do the same as the OLS is the sqreg matrix holds multiple named instances of coefficient names:

* OUTPUTS MATRIX OF COEFFICIENTS (1 X 6)
matrix list e(b)

* SAVE COEFF. MATRIX TO REGULAR MATRIX VARIABLE
mat b = e(b)

* EXTRACT BY ROW/COLUMN INTO OTHER VARIABLES
local coeff10 = b[1,1]
local coeff20 = b[1,3]
local coeff30 = b[1,5]