0

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!

akeenlogician
  • 179
  • 1
  • 8

1 Answers1

3

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]
Parfait
  • 104,375
  • 17
  • 94
  • 125
  • What about standard errors? _se[x] wouldn't work either, so I guess I would have to go into the variance-covariance matrix? – akeenlogician Oct 31 '15 at 21:29
  • See the included link, use the `e(V)` matrix which is the variance-covariance matrix. To obtain standard errors, take [square root](http://statadaily.com/category/post-estimation/) of corresponding matrix element: `sqrt(V[1,1])`. – Parfait Oct 31 '15 at 23:18