How to Perform Chi Square Test in STATA
In Stata, both the
.tabulate
and .tab
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:. tab grade gender, chi2
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 a table. Consider the following examples:. tabi 22 44 \ 34 56, chi2
. tabi 34 45 \ 34 53 \ 34 34, chi2
. tabi 34 45 36 \ 34 64 96, chi2
The first command conducts a Chi-square test for a 2x2 table, while the second and third commands run the test for 3x2 and 2x3 tables, respectively.
Comments
Post a Comment