-------------------------------------------------------------------------------
help for ttesttable
-------------------------------------------------------------------------------

Differences in means by groups including the T-test

ttesttable outcome groupvar [if] [in] [, unequal tex(str) pretable(str) posttable(str) force]

Description

ttesttable is a very simple Stata module that performs a mean-comparison test (t-Test) for all possible combinations of groups defined by a variable. For instance, if you have 4 types of observations and you would like to see if there are differences in means between groups, this module computes the t-test for all six possible combinations. The output is presented in a table of differences in means and includes the significance level of the t-test. This table can be exported directly as a LaTeX file and the underlying matrices are available for further use in Stata.

outcome This variable must be numeric and contains the variable you would like to test.

groupvar This variable must be a categorical variable with either numerical values or strings.

Options

unequal This option corresponds to the unequal option of the command ttest, meaning that no equal variances of the outcome variable are assumed for the two groups.

tex(str) Use this option to export the displayed table directly to latex. Specify the name of the file (without the file extension). The table will be generated with the LaTeX tabular environment. To include the table environment, use the options pretable(str) and posttable(str)

pretable(str) Include here LaTeX code you would like to have in the tex-file before the tabular environment. This option is only available when the option tex(str) is specified.

posttable(str) Include here LaTeX code you would like to have in the tex-file after the tabular environment. This option is only available when the option tex(str) is specified.

force By default, the program stops working when more than 10 categories are detected, since this will lead to extremely large tables and is most likely due to the use of a continuous variable as grouping variable. If you want to perform the analysis with more than the generally admitted 10 categories, use the option force, which elimiates this limit.

Output Besides the screen output and the export to LaTeX, ttesttable generates three matrices which can be accessed through "return list":

r(p) : matrix of p-values

r(t) : matrix of t statistics

r(diff) : matrix of differences in means

Example

ttesttable score country, tex(myfile) pre("\begin{table}[!ht]\centering") post("\caption{Cross table of differences in mean by group\end{table}"

This example will provide a matrix containing the differences in the average scores across countries and performs a T-test for any combination of groups. The stars will indicate if the difference is significantly different from zero. The table will be exported to the file myfile.tex and include the table environment as defined by the options pre() and post()

Author

For suggestions and questions, please contact the author: Florian Chávez Juárez: florian@chavezjuarez.com