Dear Stata listers
I have a descriptive table made with -esttab- and -estpost- (both from SSC) like this:
I would now like to add 95% confidence intervals for the Sample in the table (i.e. the left-hand column). What I have now come up with is:
I'm obviously very unhappy with this solution (misalignment in all directions, two sample columns, empty columns for ub). Is there a more elegant solution?
Bonus question:
leads to
but
does not? Can you explain that?
Thanks so much
Joaquin
I have a descriptive table made with -esttab- and -estpost- (both from SSC) like this:
Code:
// Open data sysuse auto, clear // Create a set of dummy variables called repx* qui tabulate rep78, gen(repx) // Make table eststo clear eststo g1: estpost summarize mpg repx* if foreign == 0 // Sample eststo g2: estpost summarize mpg repx* // Population esttab g1 g2, cells(mean(fmt(2)) sd(fmt(2) keep(mpg) par)) mtitles("Sample" "Population") nonumber -------------------------------------- Sample Population mean/sd mean/sd -------------------------------------- mpg 19.83 21.30 (4.74) (5.79) repx1 0.04 0.03 repx2 0.17 0.12 repx3 0.56 0.43 repx4 0.19 0.26 repx5 0.04 0.16 -------------------------------------- N 52 74 --------------------------------------
I would now like to add 95% confidence intervals for the Sample in the table (i.e. the left-hand column). What I have now come up with is:
Code:
eststo g1ci: estpost ci mpg repx* if foreign == 0 esttab g1 g1ci g2, cells(mean(fmt(2)) sd(fmt(2) keep(mpg) par) "lb(fmt(2)) ub(fmt(2))") mtitles("Sample" "Also sample" "Population") nonumber ------------------------------------------------------------------------------------------ Sample Also sample Population mean/sd/lb ub mean/sd/lb ub mean/sd/lb ub ------------------------------------------------------------------------------------------ mpg 19.83 21.30 (4.74) (5.79) 18.51 21.15 repx1 0.04 0.03 -0.02 0.10 repx2 0.17 0.12 0.06 0.28 repx3 0.56 0.43 0.42 0.71 repx4 0.19 0.26 0.07 0.30 repx5 0.04 0.16 -0.02 0.10 ------------------------------------------------------------------------------------------ N 52 52 74 ------------------------------------------------------------------------------------------
Bonus question:
Code:
ci mpg repx* if foreign == 0
Code:
you must specify one of means, proportions, or variances following ci
Code:
estpost ci mpg repx* if foreign == 0
Thanks so much
Joaquin
Comment