Presentation is loading. Please wait.

Presentation is loading. Please wait.

Categorical Data In Chapter 3 we introduced the idea of categorical data. In Chapter 15 we explored probability rules and when events are independent.

Similar presentations


Presentation on theme: "Categorical Data In Chapter 3 we introduced the idea of categorical data. In Chapter 15 we explored probability rules and when events are independent."— Presentation transcript:

1 Categorical Data In Chapter 3 we introduced the idea of categorical data. In Chapter 15 we explored probability rules and when events are independent. In Chapter 26 we put these two ideas together to compare counts. The National Opinion Research Center’s General Social Survey is conducted every 2 years.

2 Categorical Data National Opinion Research Center’s General Social Survey In 2006 a sample of 1928 adults in the U.S. were asked the question “When is premarital sex wrong?” The participants were also asked with what religion they were affiliated. The National Opinion Research Center’s General Social Survey is conducted every 2 years.

3 Who?/What? Who? What? A sample of 1928 adults.
Attitude towards premarital sex. Religious affiliation. Adults is the answer to the question who? The adult’s attitude towards premarital sex and his/her religious affiliation are the answers to the question what?

4 What? When is premarital sex wrong?
Categorical: Always Wrong, Almost Always Wrong, Sometimes Wrong, Not Wrong at All Both the attitude towards premarital sex and the religious affiliation are categorical variables.

5 What? What is your religious affiliation?
Categorical: Catholic, Jewish, Protestant, None, Other

6 When is Premarital Sex Wrong?
Religion Always Wrong Almost Always Wrong Sometimes Wrong Not Wrong at All Total Catholic 83 47 105 249 484 Jewish 4 2 9 20 35 Protestant 364 97 190 341 992 None 27 12 52 219 310 Other 28 8 51 107 506 166 376 880 1928 We can cross classify the opinion and religious affiliation. In this case 62 adults were both Catholic and responded that premarital sex is always wrong, while 384 adults were both Protestant and responded that premarital sex is never wrong. Because there are different numbers of adults affiliated with each religion it is hard to compare across religions. Can create “row” percentages by dividing the number who fell in each premarital sex category by the number in that “row”, e.g. religion.

7 When is Premarital Sex Wrong?
Religion Always Almost Always Sometimes Never Total Catholic 17.2% 9.7% 21.7% 51.4% 100% Jewish 11.4% 5.7% 25.7% 57.2% Protestant 36.7% 9.8% 19.1% 34.4% None 8.7% 3.9% 16.8% 70.6% Other 26.2% 7.5% 18.7% 47.6% With percentages it is easier to compare across religions. For example, 51% of Catholics said premarital sex is never wrong, while about 2 out of 3 Jewish adults said premarital sex is never wrong. Only about 1 in 3 Protestants said premarital sex is never wrong. So, it is twice as likely that a Jewish person will say premarital sex is never wrong compared to a Protestant. Protestants are 2 ½ times as likely to answer premarital sex is always wrong compared to Catholics.

8 Mosaic Plot The table of “row” percentages can be displayed in a mosaic plot. Here each column is a bar chart with the bars stacked on top of each other. At the far right is the bar chart for the entire set. Compare this with the bar chart on slide 11. The width of columns in the mosaic plot is proportional to the number of cases in that category. For example, there are over twice as many Protestants as Catholics and very few Jewish adults in the sample. One can compare religions by comparing the heights of the similarly colored rectangles. For example, about the same proportion of each religion has the attitude that premarital sex is sometimes wrong. Jewish adults are almost twice as likely to have the attitude that premarital sex is never wrong compared to Protestants.

9 Comparing Counts People who have no religion or are Jewish are more likely to say premarital sex is Not Wrong at All. Protestants are much more likely to say premarital sex is Always Wrong.

10 Comparing Counts Are these differences statistically significant?
Or, are these differences due to chance variation so that religion and attitude towards premarital sex are independent?

11 Pr(A and B) = Pr(A)*Pr(B)
Comparing Counts If religion and attitude towards premarital sex are independent then Pr(A and B) = Pr(A)*Pr(B) where A is a religion category and B is an attitude category.

12 Expected Count If religion and attitude toward premarital sex are independent we would expect to see n*Pr(A)*Pr(B) people in the religion category A and the attitude category B.

13 Religion Always Almost Always Sometimes Never Total Catholic 484 Jewish 35 Protestant 992 None 310 Other 107 506 166 376 880 1928

14 Expected Count Catholic and Always Wrong

15 Expected Counts Religion Always Almost Always Sometimes Never Total
Catholic 127.0 41.7 94.4 220.9 484 Jewish 9.2 3.0 6.8 16.0 35 Protestant 260.3 85.4 193.5 452.8 992 None 81.4 26.7 60.4 141.5 310 Other 28.1 20.9 48.8 107 506 166 376 880 1928

16 Observed = Expected? Take the difference between the observed and expected counts in a cell. Square the difference. Divide by the expected count. Sum up over all the cells.

17 Chi-square Test Statistic

18 Cell contributions to Catholic and Always

19 Test of Independence H0: Religion and attitude towards premarital sex are independent. HA: Religion and attitude towards premarital sex are not independent. = , df=(5-1)*(4-1)=12 P-value <

20 Test of Independence Because the P-value is so small we reject the null hypothesis. Religion and Attitude towards premarital sex are not independent.

21 Comment Look at the cells with the largest contributions to the test statistic. None and Always Wrong has much fewer people than expected and None and Not Wrong at All has much more people than expected.

22 Comment Look at the cells with the largest contributions to the test statistic. Protestant and Always Wrong has much more people than expected and Protestant and Not Wrong at All has much fewer people than expected.

23 Summary Protestants are much more likely to say Always Wrong and much less likely to say Not Wrong at All. People with no religion are much more likely to say Not Wrong at All and much less likely to say Always Wrong.

24 JMP Religion Attitude Count 1 Catholic 1 Always Wrong 83 2 Jewish 4
3 Protestant 364 4 None 27 5 Other 28 4 Not Wrong at All 51

25 JMP Fit Y by X Y, Response: Attitude X, Factor: Religion Freq: Count

26 Test ChiSquare Prob>ChiSq Likelihood Ratio <.0001* Pearson

27 Comment Remember that JMP only does the calculations for you (Step 3). You have to provide all the other steps in the test of hypothesis.


Download ppt "Categorical Data In Chapter 3 we introduced the idea of categorical data. In Chapter 15 we explored probability rules and when events are independent."

Similar presentations


Ads by Google