Categorical Data Analysis. The data are often just counts of how many things each category has.

Similar documents
Contingency Tables. Contingency tables are used when we want to looking at two (or more) factors. Each factor might have two more or levels.

Contingency Tables. Safety equipment in use Fatal Non-fatal Total. None 1, , ,128 Seat belt , ,878

Hypothesis testing I. - In particular, we are talking about statistical hypotheses. [get everyone s finger length!] n =

This is particularly true if you see long tails in your data. What are you testing? That the two distributions are the same!

One sided tests. An example of a two sided alternative is what we ve been using for our two sample tests:

Chapter 26: Comparing Counts (Chi Square)

Dealing with the assumption of independence between samples - introducing the paired design.

Regression, Part I. - In correlation, it would be irrelevant if we changed the axes on our graph.

Two sided, two sample t-tests. a) IQ = 100 b) Average height for men = c) Average number of white blood cells per cubic millimeter is 7,000.

Chapter 10. Chapter 10. Multinomial Experiments and. Multinomial Experiments and Contingency Tables. Contingency Tables.

Confidence intervals

Correlation. We don't consider one variable independent and the other dependent. Does x go up as y goes up? Does x go down as y goes up?

Statistical Analysis for QBIC Genetics Adapted by Ellen G. Dow 2017

Regression, part II. I. What does it all mean? A) Notice that so far all we ve done is math.

11-2 Multinomial Experiment

Note that we are looking at the true mean, μ, not y. The problem for us is that we need to find the endpoints of our interval (a, b).

Note that we are looking at the true mean, μ, not y. The problem for us is that we need to find the endpoints of our interval (a, b).

CHAPTER 9: HYPOTHESIS TESTING

The goodness-of-fit test Having discussed how to make comparisons between two proportions, we now consider comparisons of multiple proportions.

Violating the normal distribution assumption. So what do you do if the data are not normal and you still need to perform a test?

Lecture 9. Selected material from: Ch. 12 The analysis of categorical data and goodness of fit tests

Module 03 Lecture 14 Inferential Statistics ANOVA and TOI

Inferential statistics

Confidence Intervals. - simply, an interval for which we have a certain confidence.

Probability Methods in Civil Engineering Prof. Dr. Rajib Maity Department of Civil Engineering Indian Institution of Technology, Kharagpur

Frequency Distribution Cross-Tabulation

Ling 289 Contingency Table Statistics

Hypothesis Testing: Chi-Square Test 1

Chapter 9 Inferences from Two Samples

Chi Square Analysis M&M Statistics. Name Period Date

Multiple Regression Analysis

Study Ch. 9.3, #47 53 (45 51), 55 61, (55 59)

Testing Research and Statistical Hypotheses

Multiple Testing. Gary W. Oehlert. January 28, School of Statistics University of Minnesota

INTERVAL ESTIMATION AND HYPOTHESES TESTING

10.2: The Chi Square Test for Goodness of Fit

MA554 Assessment 1 Cosets and Lagrange s theorem

Example. χ 2 = Continued on the next page. All cells

PSY 305. Module 3. Page Title. Introduction to Hypothesis Testing Z-tests. Five steps in hypothesis testing

EC2001 Econometrics 1 Dr. Jose Olmo Room D309

Bag RED ORANGE GREEN YELLOW PURPLE Candies per Bag

Lecture 21: October 19

We're in interested in Pr{three sixes when throwing a single dice 8 times}. => Y has a binomial distribution, or in official notation, Y ~ BIN(n,p).

STAT 536: Genetic Statistics

Lecture 17: Small-Sample Inferences for Normal Populations. Confidence intervals for µ when σ is unknown

- measures the center of our distribution. In the case of a sample, it s given by: y i. y = where n = sample size.

Psych 230. Psychological Measurement and Statistics

Lecture 10: Generalized likelihood ratio test

Probability Methods in Civil Engineering Prof. Dr. Rajib Maity Department of Civil Engineering Indian Institute of Technology, Kharagpur

Significance Tests. Review Confidence Intervals. The Gauss Model. Genetics

HYPOTHESIS TESTING: THE CHI-SQUARE STATISTIC

Chapter 23. Inferences About Means. Monday, May 6, 13. Copyright 2009 Pearson Education, Inc.

How do we compare the relative performance among competing models?

Lecture 26: Chapter 10, Section 2 Inference for Quantitative Variable Confidence Interval with t

Lecture 41 Sections Mon, Apr 7, 2008

CIVL /8904 T R A F F I C F L O W T H E O R Y L E C T U R E - 8

CENTRAL LIMIT THEOREM (CLT)

Nominal Data. Parametric Statistics. Nonparametric Statistics. Parametric vs Nonparametric Tests. Greg C Elvers

STAT Chapter 8: Hypothesis Tests

Statistical Inference: Estimation and Confidence Intervals Hypothesis Testing

10.4 Hypothesis Testing: Two Independent Samples Proportion

Part 1.) We know that the probability of any specific x only given p ij = p i p j is just multinomial(n, p) where p k1 k 2

The t-test: A z-score for a sample mean tells us where in the distribution the particular mean lies

Lecture 41 Sections Wed, Nov 12, 2008

Sampling Distributions

Econ 325: Introduction to Empirical Economics

We're in interested in Pr{three sixes when throwing a single dice 8 times}. => Y has a binomial distribution, or in official notation, Y ~ BIN(n,p).

MITOCW ocw f99-lec01_300k

where Female = 0 for males, = 1 for females Age is measured in years (22, 23, ) GPA is measured in units on a four-point scale (0, 1.22, 3.45, etc.

Discrete Multivariate Statistics

Harvard University. Rigorous Research in Engineering Education

16.400/453J Human Factors Engineering. Design of Experiments II

Chapter 7 Comparison of two independent samples

Hypothesis Tests and Estimation for Population Variances. Copyright 2014 Pearson Education, Inc.

CBA4 is live in practice mode this week exam mode from Saturday!

Physics 509: Non-Parametric Statistics and Correlation Testing

Statistics 1L03 - Midterm #2 Review

The t-distribution. Patrick Breheny. October 13. z tests The χ 2 -distribution The t-distribution Summary

Introduction to Statistics

LOOKING FOR RELATIONSHIPS

Do students sleep the recommended 8 hours a night on average?

Hypothesis testing. Data to decisions

Two-sample Categorical data: Testing

Cosets and Lagrange s theorem

STAT Chapter 13: Categorical Data. Recall we have studied binomial data, in which each trial falls into one of 2 categories (success/failure).

Descriptive Statistics (And a little bit on rounding and significant digits)

Outline for Today. Review of In-class Exercise Bivariate Hypothesis Test 2: Difference of Means Bivariate Hypothesis Testing 3: Correla

Lab #12: Exam 3 Review Key

The t-statistic. Student s t Test

Sign test. Josemari Sarasola - Gizapedia. Statistics for Business. Josemari Sarasola - Gizapedia Sign test 1 / 13

Difference between means - t-test /25

Questions 3.83, 6.11, 6.12, 6.17, 6.25, 6.29, 6.33, 6.35, 6.50, 6.51, 6.53, 6.55, 6.59, 6.60, 6.65, 6.69, 6.70, 6.77, 6.79, 6.89, 6.

AMS7: WEEK 7. CLASS 1. More on Hypothesis Testing Monday May 11th, 2015

Tables Table A Table B Table C Table D Table E 675

CHI SQUARE ANALYSIS 8/18/2011 HYPOTHESIS TESTS SO FAR PARAMETRIC VS. NON-PARAMETRIC

HYPOTHESIS TESTING. Hypothesis Testing

280 CHAPTER 9 TESTS OF HYPOTHESES FOR A SINGLE SAMPLE Tests of Statistical Hypotheses

The Inductive Proof Template

Statistical Inference. Why Use Statistical Inference. Point Estimates. Point Estimates. Greg C Elvers

Physics 509: Bootstrap and Robust Parameter Estimation

Transcription:

Categorical Data Analysis So far we ve been looking at continuous data arranged into one or two groups, where each group has more than one observation. E.g., a series of measurements on one or two things. Now we're changing things: we re interested in data that is categorical. The data are often just counts of how many things each category has. For example, we're interested in blood types. We go out and collect the following data from 263 people: Number of people with blood type A: y 1 = 115 Number of people with blood type B: y 2 = 20 Number of people with blood type AB: y 3 = 17 Number of people with blood type O: y 4 = 111 Note that the y's are NOT measurements, they're counts! Now suppose we had some theory about the distribution of blood types; could we use these data to test our theory? Obviously the answer is yes. In the U.S., people have the following proportions for blood type: Blood type A: 42% Blood type B: 10% Blood type AB: 4% Blood type O: 44% Does our theory (the percentages above) match our data? The Chi-square ( χ 2 ) goodness of fit test. Or better, are our data compatible with our hypothesis? Essentially, we have a number of categories for our data, and we have some idea as to the proportions we should expect for our each of our categories. We use the chi-square test to compare our idea (= hypothesis) with the actual data. Here s a simple (made up) example from genetics: We have a simple dominant-recessive relationship. Say, yellow and purple corn kernel color. Purple is dominant, and yellow is recessive. Without going into the details, if we have two heterozygous parents, we would expect 3/4 of our offspring (= kernels) to be purple, and 1/4 yellow. IMPORTANT - you do NOT need to understand the genetics here; all you need to know is that some theory tells us we expect 3/4 purple kernels and 1/4 yellow kernels

You want to test this theory, and you go out and collect a sample of 267 corn kernels. How many do you expect to be purple? 3/4 out of 267: 3/4 x 267 = 200.25 How many yellow? 1/4 out of 267: 1/4 x 267 = 66.75 Notice - take the proportion you expect for each category and multiply this by the total number in your sample; this gives you what you expect for each category in your sample. Now you can compare this to what you actually got. Suppose you took your sample and got: 157 purple 110 yellow Looking at this, you would think you should have gotten more yellow kernels and less purple kernels. But maybe your differences are due to random chance? Set up your hypotheses: Decide on α H 0 : Pr{purple} =.75, Pr{yellow} =.25 Your H 0 is different from what you re used to; you need to specify each expected proportion. H 1 : At least one probability listed in H 0 is incorrect Let s pick 0.05 Calculate your test statistic. This is now χ 2* (or χ 2 s, as your text calls it): χ 2 * = c (O i E i ) 2 i=1 E i i goes from 1 to c, where c is the number of categories (2 in our example). for our example we have: X 2* = 157 200.25 2 200.25 110 66.75 2 66.75 = 37.36 Compare this to the tabulated χ 2 with c-1 degrees of freedom and the appropriate level of α. Introducing the χ 2 distribution.

The value you calculate, χ 2*, will follow a χ 2 distribution if n is moderately large. Notice that the χ 2 test is based on an approximation. You can get exact values, but they re a bit of a pain, and it really isn't necessary - the approximation is very good. Just like many other distributions, the value of the χ 2 distribution depends on the degrees of freedom, d.f. or ν. Here is what it looks like for a couple of different values of ν: Just like before, we reject for values that wind up in the tails (usually only in the upper tail). Finally, you make your comparison: Notice how different the χ 2 looks based on the value of ν. If χ 2* χ 2 table, we reject our H 0. Otherwise fail to reject H 0. It's important to use the correct value for the d.f. = ν or you can get very misleading results. Here s our comparison:

χ 2 * 2 2 = 37.36 χ c 1,α = χ 1,0.05 = 3.84 So we reject our H 0 and conclude that at least one of our proportions is not as specified in H 0. An important point - notice that with just two categories, if one of our proportions is wrong, that immediately implies that the other one is wrong as well (why?). Some comments: Except in the case of two categories, the alternative hypothesis is non-directional. If we have a reason to suspect a directional alternative (and have two categories), we can proceed as follows: H 0 : Pr{Male} =.6 (and therefore Pr{Female} =.4) H 1 : Pr{Male} >.6 (so what are females?) Two examples of the χ 2 test: You should be fairly comfortable with one sided tests by now. Let's do our blood group example: H 0 : Pr{blood type A} = 0.42 Pr{blood type B} = 0.10 Pr{blood type AB} = 0.04 Pr{blood type O} = 0.44 H 1 : at least one of these proportions is not correct. Let's use α =.01 So here's our data (= observed): And our expected values are: Blood type A: 115 263 x.42 = 110.46 Blood type B: 20 263 x.10 = 26.30 Blood type AB: 17 263 x.04 = 10.52 Blood type O: 111 263 x.44 = 115.72 Total: 263 So now we calculate χ 2* : χ 2* = (115 110.46)2 110.46 + (20 26.3)2 26.3 + (17 10.52)2 10.52 + (111 115.72)2 115.72 = 5.88 Get our value for χ 2 table: 2 χ 3,.01 = 11.34

Finally, because χ 2* is less than our χ 2 table, we fail to reject, and conclude that our null hypothesis is consistent with the data: We have no evidence to show that our blood type sample does not follow the proportions in the U.S. Color vision in squirrels (this example is based on the old textbook for this class: Statistics for the Life Sciences, by Samuels, Witmer, and Schaffner (which is in turn based on a study by G.H. Jacobs from 1978)): A squirrel was exposed to a red panel and two white panels. By pressing the red panel, the squirrel was rewarded; no reward was given for pressing the white panel. In 75 trials, the squirrel correctly pressed the red panel 45 times. Can the squirrel see color? Comment: any one see a problem with the experimental setup? In other words, does this experiment really test color vision in squirrels? H 0 : Pr{red} = 1/3 (so Pr{white} = 2/3) H 1 : Pr{red} 1/3 Incidentally, a squirrel is going to do the best it can to get food, so the alternative probably should be one sided here (H 1 : Pr{red} > 1/3). More on that soon. Let's use α =.01 Calculate our expected: For red, 75 x 1/3 = 25 For white, 75 x 2/3 = 50 Note that the actual (observed) proportion for red is 45/75 = 0.6 Calculate our χ 2* : This would have agreed with our directional alternative if we had used it And our χ 2 table is: X 2* = 45 25 2 25 χ 2 1,0.02 = 6.63 30 50 2 50 = 24 And since χ 2* >> χ 2 table, we reject H 0 and conclude that squirrels can see the color red. Incidentally, if you wanted to do a one sided test, you'd do almost everything the same, with the following modifications:

Use the correct H 1 Verify that the data agree with H 1 Use the appropriate column in your χ 2 tables, but divided by 2 (i.e., use α/2). For our squirrel example, you'd get: 2 χ 1,0.025 = 5.41 Notice that the critical value got smaller - as usual, one sided tests make it easier to reject the H 0 ; we get more power! Bottom line: we are very confident that squirrels can see the color red. The assumptions of the χ 2 test: The data are collected randomly (you just can t get away from this one!) The smallest expected value is at least 5 (the observed value is irrelevant!). The χ 2 test is an approximation, and approximations get better the bigger the sample size. You can often determine ahead of time what your expected values will be. If they're too small you might consider increasing your sample size. There are other techniques for dealing with smaller sample sizes, but we won t learn them here.