In Stata, how do I conduct a Chi-square test with aggregate data?
In Stata, both the .tabulate and
.tabi commands conduct the Pearson's Chi-square test. The
.tabulate (may be abbreviated as .tab)
command produces one- or two-way frequency tables given one or two
variables. The commands also can run a Chi-square test using the
chi2 option:
The above command will produce a cross-table of grade and
gender and its Chi-square statistic.
When you do not have individual data, but only aggregate frequencies, use
the .tabi command. You must list the frequencies of each cell
with a backward slash ( \ ) to separate a row of
table. Consider the following examples:
The first command conducts a Chi-square test for a 2 by 2 table, while the second and third commands run the test for 3 by 2 and 2 by 3 tables, respectively.
For more about statistical and mathematical software, email the UITS Stat/Math Center, visit the center's web page, or phone 812-855-4724 (IUB) or 317-278-4740 (IUPUI). The center is located in Bloomington at 410 N. Park Avenue, and is open for consultation by appointment Monday-Friday 9am-5pm.
Last modified on March 17, 2011.







