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:
- Group spatial lags that were estimated using different weighting matrices together.
- Rename the "groups" under which the variables are displayed.
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
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
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
0 Response to Spregress and esttab
Post a Comment