

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Stata commands and examples for conducting chi-square analysis using the 'tabi' command and the 'drinks' dataset. The first example demonstrates how to use the 'tabi' command with the 'chi2' option to analyze a 3x3 contingency table. The second example uses the 'tab' command to analyze the relationship between 'drinks' and 'religion' data, and sets missing values and labels accordingly. The document also includes the output of the chi-square tests and their respective p-values.
Typology: Study notes
1 / 2
This page cannot be seen from the preview
Don't miss anything!


. * in Stata . use "D:\soci708\data\survey2b.dta", clear . tab drinks ... . label define noyes 0 "No" 1 "Yes" . label values drinks noyes . tab drinks DRINKS | Freq. Percent Cum. ------------+----------------------------------- No | 52 20.31 20. Yes | 204 79.69 100. ------------+----------------------------------- Total | 256 100. . tab religion RELIGION | Freq. Percent Cum. ------------+----------------------------------- 1 | 133 51.95 51. 2 | 46 17.97 69. 3 | 23 8.98 78. 4 | 52 20.31 99.
Total | 256 100.
. * set missing to two odd answers . replace religion=. if religion== (2 real changes made, 2 to missing) . label define denom 1 "Prot" 2 "Cath" 3 "Jewi" 4 "None" . label values religion denom . tab religion drinks | DRINKS RELIGION | No Yes | Total -----------+----------------------+---------- Prot | 39 94 | 133 Cath | 6 40 | 46 Jewi | 2 21 | 23 None | 5 47 | 52 -----------+----------------------+---------- Total | 52 202 | 254 . tab religion drinks, row nofreq V chi2 lr | DRINKS RELIGION | No Yes | Total -----------+----------------------+---------- Prot | 29.32 70.68 | 100. Cath | 13.04 86.96 | 100. Jewi | 8.70 91.30 | 100. None | 9.62 90.38 | 100. -----------+----------------------+---------- Total | 20.47 79.53 | 100. Pearson chi2(3) = 13.6827 Pr = 0. likelihood-ratio chi2(3) = 14.4258 Pr = 0. Cramér's V = 0. .