Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 73334

Spregress and esttab

$
0
0
Hello,

I am working with spatial data and trying to export my estimation results from the spregress command using the user-written package esttab (SSC). I am trying (and struggling) to manipulate esttab output to achieve two things:
  1. Group spatial lags that were estimated using different weighting matrices together.
  2. Rename the "groups" under which the variables are displayed.
Here is an example of the problem:
Code:
copy https://www.stata-press.com/data/r16/homicide1990.dta .
copy https://www.stata-press.com/data/r16/homicide1990_shp.dta .
use homicide1990
spmatrix create contiguity W
spmatrix create idistance W2

eststo model1: spregress hrate ln_population ln_pdensity gini, gs2sls dvarlag(W) ivarlag(W: gini) ivarlag(W2: ln_population ln_pdensity)
esttab model1
The table that I get looks like this:
Code:
----------------------------
                      (1)   
                    hrate   
----------------------------
hrate                       
ln_populat~n        0.894**
                   (2.66)   
ln_pdensity         0.179   
                   (0.54)   
gini                80.10***
                  (13.84)   
_cons              -34.25***
                  (-8.57)   
----------------------------
W                           
gini               -5.941   
                  (-1.58)   
hrate               0.301**
                   (2.58)   
----------------------------
W2                          
ln_populat~n       -0.521   
                  (-1.11)   
ln_pdensity         1.864   
                   (1.84)   
----------------------------
N                    1412   
----------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

What I would like to get instead is something like that:
Code:
----------------------------
                      (1)   
                    hrate   
----------------------------
hrate                       
ln_populat~n        0.894**
                   (2.66)   
ln_pdensity         0.179   
                   (0.54)   
gini                80.10***
                  (13.84)   
_cons              -34.25***
                  (-8.57)   
----------------------------
New name                         
gini               -5.941   
                  (-1.58)   
hrate               0.301**
                   (2.58)                         
ln_populat~n       -0.521   
                  (-1.11)   
ln_pdensity         1.864   
                   (1.84)   
----------------------------
N                    1412   
----------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
I've noticed that the variable names are stored in an unfamiliar to me notation which may hint as to what the possible solution is:
Code:
. di e(exogr)
hrate:ln_population hrate:ln_pdensity hrate:gini hrate:_cons exog*W:gini exog*W2:ln_population exog*W2:ln_pdensity endog*W:hrate
Using the rename option or the varlabel option does not help. Would anyone happen to have any suggestions on how to approach it?

Viewing all articles
Browse latest Browse all 73334

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>