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

Slides:



Advertisements
Similar presentations
Chapter 11 Other Chi-Squared Tests
Advertisements

CHI-SQUARE(X2) DISTRIBUTION
Contingency Tables Chapters Seven, Sixteen, and Eighteen Chapter Seven –Definition of Contingency Tables –Basic Statistics –SPSS program (Crosstabulation)
Basic Statistics The Chi Square Test of Independence.
Chapter 11 Contingency Table Analysis. Nonparametric Systems Another method of examining the relationship between independent (X) and dependant (Y) variables.
Analysis of frequency counts with Chi square
Copyright ©2011 Brooks/Cole, Cengage Learning More about Inference for Categorical Variables Chapter 15 1.
1-1 Copyright © 2015, 2010, 2007 Pearson Education, Inc. Chapter 25, Slide 1 Chapter 25 Comparing Counts.
Chi-square Test of Independence
Sociology 601 Class12: October 8, 2009 The Chi-Squared Test (8.2) – expected frequencies – calculating Chi-square – finding p When (not) to use Chi-squared.
Crosstabs and Chi Squares Computer Applications in Psychology.
Chapter 26: Comparing Counts. To analyze categorical data, we construct two-way tables and examine the counts of percents of the explanatory and response.
Crosstabs. When to Use Crosstabs as a Bivariate Data Analysis Technique For examining the relationship of two CATEGORIC variables  For example, do men.
Problem 1: Relationship between Two Variables-1 (1)
Cross Tabulation and Chi-Square Testing. Cross-Tabulation While a frequency distribution describes one variable at a time, a cross-tabulation describes.
1 Psych 5500/6500 Chi-Square (Part Two) Test for Association Fall, 2008.
Copyright © 2010, 2007, 2004 Pearson Education, Inc. Chapter 26 Comparing Counts.
Copyright © 2010 Pearson Education, Inc. Warm Up- Good Morning! If all the values of a data set are the same, all of the following must equal zero except.
Chapter 9: Non-parametric Tests n Parametric vs Non-parametric n Chi-Square –1 way –2 way.
Chi-Square X 2. Parking lot exercise Graph the distribution of car values for each parking lot Fill in the frequency and percentage tables.
Slide 26-1 Copyright © 2004 Pearson Education, Inc.
Chapter 11 Chi- Square Test for Homogeneity Target Goal: I can use a chi-square test to compare 3 or more proportions. I can use a chi-square test for.
Copyright © 2010 Pearson Education, Inc. Slide
Inference for Distributions of Categorical Variables (C26 BVD)
© Copyright McGraw-Hill CHAPTER 11 Other Chi-Square Tests.
Reasoning in Psychology Using Statistics Psychology
Chapter 13 Inference for Counts: Chi-Square Tests © 2011 Pearson Education, Inc. 1 Business Statistics: A First Course.
4 normal probability plots at once par(mfrow=c(2,2)) for(i in 1:4) { qqnorm(dataframe[,1] [dataframe[,2]==i],ylab=“Data quantiles”) title(paste(“yourchoice”,i,sep=“”))}
Copyright © 2010 Pearson Education, Inc. Warm Up- Good Morning! If all the values of a data set are the same, all of the following must equal zero except.
Copyright © 2013, 2009, and 2007, Pearson Education, Inc. Chapter 11 Analyzing the Association Between Categorical Variables Section 11.2 Testing Categorical.
Bullied as a child? Are you tall or short? 6’ 4” 5’ 10” 4’ 2’ 4”
1 1 Slide © 2008 Thomson South-Western. All Rights Reserved Chapter 12 Tests of Goodness of Fit and Independence n Goodness of Fit Test: A Multinomial.
Statistical Analysis ANOVA Roderick Graham Fashion Institute of Technology.
Class Seven Turn In: Chapter 18: 32, 34, 36 Chapter 19: 26, 34, 44 Quiz 3 For Class Eight: Chapter 20: 18, 20, 24 Chapter 22: 34, 36 Read Chapters 23 &
Chi Square Test of Homogeneity. Are the different types of M&M’s distributed the same across the different colors? PlainPeanutPeanut Butter Crispy Brown7447.
11.1 Chi-Square Tests for Goodness of Fit
Basic Statistics The Chi Square Test of Independence.
Lecture notes 10a: Inference for categorical variables
Chapter 9: Non-parametric Tests
Statistical Data Analysis - Lecture 06 14/03/03
Chapter 12 Tests with Qualitative Data
Active Learning Lecture Slides
CHAPTER 11 Inference for Distributions of Categorical Data
Chapter 25 Comparing Counts.
Is a persons’ size related to if they were bullied
Chapter 11: Inference for Distributions of Categorical Data
CHAPTER 11 Inference for Distributions of Categorical Data
Contingency Tables (cross tabs)
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.
CHAPTER 11 Inference for Distributions of Categorical Data
Lesson 11 - R Chapter 11 Review:
Paired Samples and Blocks
Analyzing the Association Between Categorical Variables
Chapter 26 Comparing Counts.
Week 3 Lecture Notes PSYC2021: Winter 2019.
CHAPTER 1 Exploring Data
CHAPTER 11 Inference for Distributions of Categorical Data
Chapter 26 Comparing Counts.
CHAPTER 11 Inference for Distributions of Categorical Data
HIMS 650 Homework set 5 Putting it all together
CHAPTER 11 Inference for Distributions of Categorical Data
Chapter 26 Comparing Counts Copyright © 2009 Pearson Education, Inc.
Inference for Two Way Tables
CHAPTER 11 Inference for Distributions of Categorical Data
CHAPTER 11 Inference for Distributions of Categorical Data
Chapter 26 Comparing Counts.
Inference for Two-way Tables
Unit 1: Analyzing Data – Describing Distributions
CHAPTER 11 Inference for Distributions of Categorical Data
CHAPTER 11 Inference for Distributions of Categorical Data
Presentation transcript:

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.

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.

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?

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.

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

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.

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.

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.

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.

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?

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.

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.

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

Expected Count Catholic and Always Wrong

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

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.

Chi-square Test Statistic

Cell contributions to Catholic and Always

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

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

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.

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.

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.

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

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

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

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.