help for ttab (August 8, 2013)

tables with t-test for two-groups mean-comparison

ttab varlist [if] [in], by(groupvars) [options]

ttab_options

*by(groupvars) specifies the groupvar that defines the two groups that ttest will use to test the hypothesis that their means are equal, and implies an unpaired (two sample) t test.
More than one groupvar can be specified. If this is the case, ttab will stack the resulting tables.

over(varname) group over subpopulations defined by varname.

over2(varname2) group over subpopulations defined by varname2.

tshow displays the t-test statistic (and related p-value, if requested through the estout option se) instead of the means' difference (and related standard error).

tofile(filename [, replace]) specifies a filename to export the table. You have to specify the filename in quotes if it contains blanks or other special characters.

byvarslabels(string) specifies labels for the by() variable(s).

title(string) specifies the title for the table. It is rarely used.

ttest(string) specifies the ttest options to perform the two-group mean-comparison test.

estout(string) specifies the estout options to format the output table. estout must be installed.

*by(groupvars) is required.

Description

ttab displays a table of means for the variable(s) specified in varlist together with a t-test for the two-groups mean-comparison. The two groups are defined by the variable(s) specified in by(groupvars).
over(varname) and over2(varname2) can be used to group over subpopulations defined by varname and varname2.

ttab is basically a wrapper for ttest and estout.
It makes use of ttest to perform the two-groups mean-comparison test.
It makes use of estout to produce and display a publication quality table that can be simply displayed or exported as a separate file. See estout for more details on the "style" for the output table.

Example

webuse byssin

ttab pop, by(smokes) estout(c(b(fmt(2) star)) mlab(,none) collab(,none))

ttab pop, by(smokes) over(race) estout(c(b(fmt(2) star)) mlab("other" "white") collab(,none))

ttab pop, by(smokes) over(race) over2(workplace) estout(c(b(fmt(2)) se(fmt(3) par)) ///
mlab("white" "white" "white" "other" "other" "other") ///
mgroups("least" "less" "most", pattern(1 0 1 0 1 0)) collab(,none))

ttab pop, by(smokes) over(race) over2(workplace) tshow estout(c(b(fmt(2)) se(fmt(3) par))
mlab("white" "white" "white" "other" "other" "other") ///
mgroups("least" "less" "most", pattern(1 0 1 0 1 0)) collab(,none))

Authors

Federico Belotti
Tor Vergata University
federico.belotti@uniroma2.it