You can install -suregr- from within Stata by typing
Code:
ssc describe suregr ssc install suregr
The command -suregr- implements automatically the methods and formulas in my recent paper Kolev (2021) "Robust and/or cluster-robust variance estimation in Seemingly Unrelated Regressions, and in Multivariate Regressions," and if you are interested in the methods and formulas I can send you the paper.
What my -robustr- does is replace the standard variance with the (cluster-) robust variance and display -sureg- table with the robust standard errors. Everything that works with -sureg- still works as before, say you can impose linear constraints in the -sureg- estimation stage, and you can use -test-, -nlcom- and -lincom- after -suregr- as usual.
Examples of use follow below:
Code:
. sysuse auto, clear
(1978 Automobile Data)
.
. * Typical use of -suregr-, we firstly fit -sureg- quitetly, and then we follow up with -sureg-
. * to get the robust variance.
. * If we do not specify the minus option, the default is minus(0) meaning no degrees of freedom adjustmen
> t.
. * Of course if we want to see the non-robust standard errors as well we can also run -sureg- noisily.
.
. quietly sureg (price headroom) (mpg weight length)
.
. suregr
Seemingly unrelated regression
--------------------------------------------------------------------------
Equation Obs Parms RMSE "R-sq" chi2 P
--------------------------------------------------------------------------
price 74 1 2910.242 0.0131 0.94 0.3314
mpg 74 2 3.34875 0.6604 136.53 0.0000
--------------------------------------------------------------------------
------------------------------------------------------------------------------
| Robust
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
price |
headroom | 389.6366 295.9122 1.32 0.188 -190.3406 969.6139
_cons | 4998.979 843.8949 5.92 0.000 3344.976 6652.983
-------------+----------------------------------------------------------------
mpg |
weight | -.0033167 .0019688 -1.68 0.092 -.0071756 .0005422
length | -.0916353 .0682694 -1.34 0.180 -.2254408 .0421703
_cons | 48.53323 7.544959 6.43 0.000 33.74538 63.32108
------------------------------------------------------------------------------
.
. * Typical use for getting the cluster-robust variance. We use the minus(1) degree of freedom adjustment,
>
. * because this is the common adjustment cluster-robust variance estimators in native Stata commands use.
. * We also use the option noheader to omit the header from our regression table.
.
. quietly sureg (price headroom) (mpg weight length)
.
. suregr, cluster(rep) minus(1) noheader
(Std. Err. adjusted for 5 clusters in rep78)
------------------------------------------------------------------------------
| Robust
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
price |
headroom | 382.429 119.2846 3.21 0.001 148.6355 616.2224
_cons | 4998.757 383.9062 13.02 0.000 4246.314 5751.199
-------------+----------------------------------------------------------------
mpg |
weight | -.0027392 .0012197 -2.25 0.025 -.0051298 -.0003487
length | -.1121001 .0352499 -3.18 0.001 -.1811887 -.0430115
_cons | 50.70261 6.473076 7.83 0.000 38.01561 63.3896
------------------------------------------------------------------------------
.
.
. * Post estimation after -suregr- works as usual.
. * -suregr- has substituted the (cluster-)robust variance, and the postestimation commands like -test-
. * -lincom- and -nlcom- use the (cluster-)robust variance in the calculations they are carrying out:
.
. quietly sureg (price headroom) (mpg weight length)
.
. suregr, cluster(rep) minus(1) noheader
(Std. Err. adjusted for 5 clusters in rep78)
------------------------------------------------------------------------------
| Robust
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
price |
headroom | 382.429 119.2846 3.21 0.001 148.6355 616.2224
_cons | 4998.757 383.9062 13.02 0.000 4246.314 5751.199
-------------+----------------------------------------------------------------
mpg |
weight | -.0027392 .0012197 -2.25 0.025 -.0051298 -.0003487
length | -.1121001 .0352499 -3.18 0.001 -.1811887 -.0430115
_cons | 50.70261 6.473076 7.83 0.000 38.01561 63.3896
------------------------------------------------------------------------------
.
. test [price]headroom = [mpg]weight
( 1) [price]headroom - [mpg]weight = 0
chi2( 1) = 10.28
Prob > chi2 = 0.0013
.
. nlcom [price]headroom/[mpg]weight
_nl_1: [price]headroom/[mpg]weight
------------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_nl_1 | -139611.7 70247.72 -1.99 0.047 -277294.7 -1928.649
------------------------------------------------------------------------------
.
. * Imposing linear constraints works as usual too
.
. constraint define 1 [price]headroom = [mpg]weight
.
. quietly sureg (price headroom) (mpg weight length), constraint(1)
.
. suregr, noheader
( 1) [price]headroom - [mpg]weight = 0
------------------------------------------------------------------------------
| Robust
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
price |
headroom | -.0025949 .0020145 -1.29 0.198 -.0065432 .0013534
_cons | 6165.265 340.5458 18.10 0.000 5497.807 6832.722
-------------+----------------------------------------------------------------
mpg |
weight | -.0025949 .0020145 -1.29 0.198 -.0065432 .0013534
length | -.1057886 .0695312 -1.52 0.128 -.2420672 .03049
_cons | 49.01368 7.647086 6.41 0.000 34.02566 64.00169
------------------------------------------------------------------------------
.
.
.Kolev, Gueorgui I. (2021). Robust and/or cluster-robust variance estimation in Seemingly Unrelated Regressions, and in Multivariate Regressions.
(under review at the Stata Journal, available upon request from the author).
0 Response to New post-estimation command -suregr- available on SSC: calculates robust, or cluster robust variance post -sureg- estimation.
Post a Comment