I want to build a table comparing the elasticities (for two groups) computed after estimating a demand system. How can I make this table? The following example shows what I am trying to do.
I get the following after each post-estimation:
I want to build a table with two columns, the first one showing the elasticities for the first group (adults>1) and for each good, and the second one showing the elasticities for the second group (adults=>1).
Code:
use https://www.stata-press.com/data/r18/food_consumption, clear quietly demandsys quaids w_dairy w_proteins w_fruitveg w_flours w_misc, /// prices(p_dairy p_proteins p_fruitveg p_flours p_misc) /// expenditures(expfd) demographics(n_kids n_adults)
Code:
collect _r_b _r_se, tag(model[(1)]): estat elasticities if n_adults>1, expenditure atmeans Expenditure elasticities Number of obs = 3,126 ------------------------------------------------------------------------------ Expenditure | Elasticity Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- Good | 1 | .9284334 .0190973 48.62 0.000 .8910034 .9658635 2 | 1.07207 .0118934 90.14 0.000 1.04876 1.095381 3 | .9621295 .0156971 61.29 0.000 .9313637 .9928952 4 | .8856269 .0181768 48.72 0.000 .8500011 .9212527 5 | 1.018794 .0206548 49.32 0.000 .9783113 1.059277 ------------------------------------------------------------------------------
Code:
collect _r_b _r_se, tag(model[(2)]): estat elasticities if n_adults<=1, expenditure atmeans Expenditure elasticities Number of obs = 1,034 ------------------------------------------------------------------------------ Expenditure | Elasticity Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- Good | 1 | .8883121 .0179679 49.44 0.000 .8530957 .9235285 2 | 1.111181 .0118684 93.63 0.000 1.087919 1.134442 3 | .9737836 .0135815 71.70 0.000 .9471642 1.000403 4 | .8533956 .0182912 46.66 0.000 .8175455 .8892458 5 | .9627577 .0210022 45.84 0.000 .9215942 1.003921 ------------------------------------------------------------------------------
Comment