I would like to use -margins, pwcompare- to generate a table. Here is an example using the auto data set:
This gives:
and
But, what I would like is something like this:
I cannot figure out how to extract the confidence interval and the p-value for the pairwise comparison, nor how to stack the tables as shown. Any help would be greatly appreciated.
Thanks!
Code:
sysuse auto reg mpg i.foreign collect: margins foreign, pwcompare(eff) collect label levels result _r_b "MPG", modify collect label levels result b_vs "MPG", modify collect layout (colname[0.foreign 1.foreign]) (result[_r_b _r_ci]) collect layout (1vs0.foreign) (result[b_vs])
Code:
--------------------------------------
| MPG 95% CI
---------+----------------------------
Domestic | 19.82692 18.34634 21.30751
Foreign | 24.77273 22.49646 27.04899
--------------------------------------
Code:
--------
MPG
--------
4.945804
--------
Code:
------------------------------------------------- | MPG 95% CI p-value ---------+--------------------------------------- Domestic | 19.82692 18.34634 21.30751 Foreign | 24.77273 22.49646 27.04899 ------------------------------------------------- Diff | 4.945804 2.230384 7.66123 0.001 -------------------------------------------------
Thanks!
Comment