I want to have a nice LaTeX table with some statistical information about some variables of my data : some come from tabstat command (mean, sd...), and one information comes from a Moran test (spatgsa command).
I'm able to construct a nice table (from a matrix I built) with all my needed elements (mean, sd, ..., Moran test ant the corresponding pvalue) but I would prefer to have stars indicating the significance of the Moran Test (rather than the pvalue).
Code:
. qui eststo statdesc:estpost tabstat var1 var2 , statistics(mean sd min p50 max) columns(statistics) . mat table = (e(mean) \ e(sd) \ e(min) \ e(p50) \ e(max) ) . mat table = table' . mat list table table[2,5] mean sd min p50 max var1 .12291754 .06572319 0 .12195122 .35714287 var2 3099.3712 539.94044 1942.5568 3034.1272 5915.2041 . spatgsa var1 var2, weights(W) moran Measures of global spatial autocorrelation Weights matrix -------------------------------------------------------------- Name: W Type: Imported (non-binary) Row-standardized: No -------------------------------------------------------------- Moran's I -------------------------------------------------------------- Variables | I E(I) sd(I) z p-value* --------------------+----------------------------------------- var1 | 0.174 -0.004 0.050 3.579 0.000 var2 | 0.029 -0.004 0.049 0.662 0.254 -------------------------------------------------------------- *1-tail test . mat Moran=r(Moran) . mat M1=Moran[.,1..1] /*Moran test*/ . mat M5=Moran[.,5..5] /*pvalue*/ . matrix rownames M5 = pvalue . . mat Big=table,M1, M5 . esttab matrix(Big, fmt(2 2 2 2 2 2 2)) ------------------------------------------------------------------------------------------------------- Big mean sd min p50 max stat p-value ------------------------------------------------------------------------------------------------------- var1 0.12 0.07 0.00 0.12 0.36 0.17 0.00 var2 3099.37 539.94 1942.56 3034.13 5915.20 0.03 0.25 -------------------------------------------------------------------------------------------------------
0 Response to How to put stars instead of pvalues in output of esttab from a non estimation command
Post a Comment