Paired Samples and Blocks

Slides:



Advertisements
Similar presentations
Copyright © 2010 Pearson Education, Inc. Slide
Advertisements

Chapter 26 Comparing Counts
Chapter 25: Paired Samples and Blocks. Paired Data Paired data arise in a number of ways. Compare subjects with themselves before and after treatment.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 25 Paired Samples and Blocks.
Copyright © 2009 Pearson Education, Inc. Chapter 29 Multiple Regression.
1-1 Copyright © 2015, 2010, 2007 Pearson Education, Inc. Chapter 25, Slide 1 Chapter 25 Comparing Counts.
Chapter 26: Comparing Counts
Copyright © 2010 Pearson Education, Inc. Chapter 25 Paired Samples and Blocks.
Copyright © 2010 Pearson Education, Inc. Chapter 24 Comparing Means.
Copyright © 2012 Pearson Education. All rights reserved Copyright © 2012 Pearson Education. All rights reserved. Chapter 15 Inference for Counts:
1-1 Copyright © 2015, 2010, 2007 Pearson Education, Inc. Chapter 23, Slide 1 Chapter 23 Comparing Means.
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.
Copyright © 2010, 2007, 2004 Pearson Education, Inc. Chapter 25 Paired Samples and Blocks.
Copyright © 2010, 2007, 2004 Pearson Education, Inc. Chapter 24 Comparing Means.
1-1 Copyright © 2015, 2010, 2007 Pearson Education, Inc. Chapter 24, Slide 1 Chapter 24 Paired Samples and Blocks.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 24 Comparing Means.
CHAPTER 26: COMPARING COUNTS OF CATEGORICAL DATA To test claims and make inferences about counts for categorical variables Objective:
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Chapter 26: Comparing counts of categorical data
Copyright © 2010, 2007, 2004 Pearson Education, Inc. Chapter 25 Paired Samples and Blocks.
1-1 Copyright © 2015, 2010, 2007 Pearson Education, Inc. Chapter 25, Slide 1 Chapter 26 Comparing Counts.
Slide 26-1 Copyright © 2004 Pearson Education, Inc.
Copyright © 2010 Pearson Education, Inc. Chapter 22 Comparing Two Proportions.
Copyright © 2010, 2007, 2004 Pearson Education, Inc. Chapter 22 Comparing Two Proportions.
Copyright © 2010 Pearson Education, Inc. Slide
Comparing Counts.  A test of whether the distribution of counts in one categorical variable matches the distribution predicted by a model is called a.
Chapter 13 Inference for Counts: Chi-Square Tests © 2011 Pearson Education, Inc. 1 Business Statistics: A First Course.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 25 Paired Samples and Blocks.
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 © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2010, 2007, 2004 Pearson Education, Inc. Chapter 25 Paired Samples and Blocks.
Paired Samples and Blocks
1-1 Copyright © 2015, 2010, 2007 Pearson Education, Inc. Chapter 24, Slide 1 Chapter 25 Paired Samples and Blocks.
Comparing Counts Chapter 26. Goodness-of-Fit A test of whether the distribution of counts in one categorical variable matches the distribution predicted.
Statistics 25 Paired Samples. Paired Data Data are paired when the observations are collected in pairs or the observations in one group are naturally.
Statistics 26 Comparing Counts. Goodness-of-Fit A test of whether the distribution of counts in one categorical variable matches the distribution predicted.
Chapter 11: Categorical Data n Chi-square goodness of fit test allows us to examine a single distribution of a categorical variable in a population. n.
AP Statistics Chapter 25 Paired Samples and Blocks.
Comparing Observed Distributions A test comparing the distribution of counts for two or more groups on the same categorical variable is called a chi-square.
Copyright © 2009 Pearson Education, Inc. Chapter 25 Paired Samples and Blocks.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Goodness-of-Fit A test of whether the distribution of counts in one categorical variable matches the distribution predicted by a model is called a goodness-of-fit.
Comparing Counts Chi Square Tests Independence.
CHAPTER 26 Comparing Counts.
Chapter 14 Inference on the Least-Squares Regression Model and Multiple Regression.
Paired Samples and Blocks
Paired Samples and Blocks
Chapter 24 Comparing Means.
Chapter 23 Comparing Means.
Chapter 25: Paired t-Test
Chapter 23 Comparing Means.
Paired Samples and Blocks
Chapter 25 Comparing Counts.
Comparing Two Proportions
Chapter 25: Paired Samples and Blocks
Chapter 23 Comparing Means.
Paired Samples and Blocks
Comparing Two Proportions
Chapter 11: Inference for Distributions of Categorical Data
Paired Samples and Blocks
15.1 Goodness-of-Fit Tests
Chapter 26 Comparing Counts.
Chapter 24 Comparing Means Copyright © 2009 Pearson Education, Inc.
Paired Samples and Blocks
Chapter 26 Comparing Counts Copyright © 2009 Pearson Education, Inc.
Inferences for Regression
Chapter 26 Comparing Counts.
Presentation transcript:

Paired Samples and Blocks Chapter 25 Paired Samples and Blocks Copyright © 2009 Pearson Education, Inc.

Paired Data Data are paired when the observations are collected in pairs or the observations in one group are naturally related to observations in the other group. Paired data arise in a number of ways. Perhaps the most common is to compare subjects with themselves before and after a treatment. When pairs arise from an experiment, the pairing is a type of blocking. When they arise from an observational study, it is a form of matching.

Paired Data (cont.) If you know the data are paired, you can (and must!) take advantage of it. To decide if the data are paired, consider how they were collected and what they mean (check the W’s). There is no test to determine whether the data are paired. Once we know the data are paired, we can examine the pairwise differences. Because it is the differences we care about, we treat them as if they were the data and ignore the original two sets of data.

Paired Data (cont.) Now that we have only one set of data to consider, we can return to the simple one-sample t-test. Mechanically, a paired t-test is just a one-sample t-test for the mean of the pairwise differences. The sample size is the number of pairs.

Assumptions and Conditions Paired Data Assumption: Paired data Assumption: The data must be paired. Independence Assumption: Independence Assumption: The differences must be independent of each other. Randomization Condition: Randomness can arise in many ways. What we want to know usually focuses our attention on where the randomness should be. 10% Condition: When a sample is obviously small, we may not explicitly check this condition. Normal Population Assumption: We need to assume that the population of differences follows a Normal model. Nearly Normal Condition: Check this with a histogram or Normal probability plot of the differences.

A Paired t-Test The paired t-test When the conditions are met, we are ready to test whether the paired differences differ significantly from zero. We test the hypothesis H0: d = 0, where the d’s are the pairwise differences and 0 is almost always 0.

A Paired t-Test (cont.) The paired t-test We use the statistic where is the mean of the pairwise differences and n is the number of pairs. is the ordinary standard error for the mean applied to the differences. When the conditions are met and the null hypothesis is true, this statistic follows a Student’s t-model with n – 1 degrees of freedom, so we can use that model to obtain a P-value.

Confidence Intervals for Matched Pairs Paired t-interval When the conditions are met, we are ready to find the confidence interval for the mean of the paired differences. The confidence interval is where the standard error of the mean difference is The critical value t* depends on the particular confidence level, C, that you specify and on the degrees of freedom, n – 1, which is based on the number of pairs, n.

Blocking Consider estimating the mean difference in age between husbands and wives. The following display is worthless. It does no good to compare all the wives as a group with all the husbands—we care about the paired differences.

Blocking (cont.) In this case, we have paired data—each husband is paired with his respective wife. The display we are interested in is the difference in ages:

Blocking (cont.) Pairing removes the extra variation that we saw in the side-by-side boxplots and allows us to concentrate on the variation associated with the difference in age for each pair. A paired design is an example of blocking.

What Can Go Wrong? Don’t use a two-sample t-test for paired data. Don’t use a paired-t method when the samples aren’t paired. Don’t forget outliers—the outliers we care about now are in the differences. Don’t look for the difference between means of paired groups with side-by-side boxplots.

What have we learned? Pairing can be a very effective strategy. Because pairing can help control variability between individual subjects, paired methods are usually more powerful than methods that compare independent groups. Analyzing data from matched pairs requires different inference procedures. Paired t-methods look at pairwise differences. We test hypotheses and generate confidence intervals based on these differences. We learned to Think about the design of the study that collected the data before we proceed with inference.

Chapter 26 Comparing Counts Copyright © 2009 Pearson Education, Inc.

Goodness-of-Fit A test of whether the distribution of counts in one categorical variable matches the distribution predicted by a model is called a goodness-of-fit test. As usual, there are assumptions and conditions to consider…

Assumptions and Conditions Counted Data Condition: Check that the data are counts for the categories of a categorical variable. Independence Assumption: The counts in the cells should be independent of each other. Randomization Condition: The individuals who have been counted and whose counts are available for analysis should be a random sample from some population.

Assumptions and Conditions (cont.) Sample Size Assumption: We must have enough data for the methods to work. Expected Cell Frequency Condition: We should expect to see at least 5 individuals in each cell. This is similar to the condition that np and nq be at least 10 when we tested proportions.

Calculations Since we want to examine how well the observed data reflect what would be expected, it is natural to look at the differences between the observed and expected counts (Obs – Exp). These differences are actually residuals, so we know that adding all of the differences will result in a sum of 0. That’s not very helpful.

Calculations (cont.) We’ll handle the residuals as we did in regression, by squaring them. To get an idea of the relative sizes of the differences, we will divide these squared quantities by the expected values.

Calculations (cont.) The test statistic, called the chi-square (or chi-squared) statistic, is found by adding up the sum of the squares of the deviations between the observed and expected counts divided by the expected counts:

Calculations (cont.) The chi-square models are actually a family of distributions indexed by degrees of freedom (much like the t-distribution). The number of degrees of freedom for a goodness-of-fit test is n – 1, where n is the number of categories.

Chi-Square P-Values The chi-square statistic is used only for testing hypotheses, not for constructing confidence intervals. If the observed counts don’t match the expected, the statistic will be large—it can’t be “too small.” So the chi-square test is always one-sided. If the calculated value is large enough, we’ll reject the null hypothesis.

Chi-Square P-Values (cont.) The mechanics may work like a one-sided test, but the interpretation of a chi-square test is in some ways many-sided. There are many ways the null hypothesis could be wrong. There’s no direction to the rejection of the null model—all we know is that it doesn’t fit.

The Chi-Square Calculation Find the expected values: Every model gives a hypothesized proportion for each cell. The expected value is the product of the total number of observations times this proportion. Compute the residuals: Once you have expected values for each cell, find the residuals, Observed – Expected. Square the residuals.

The Chi-Square Calculation (cont.) Compute the components. Now find the components for each cell. Find the sum of the components (that’s the chi-square statistic).

The Chi-Square Calculation (cont.) Find the degrees of freedom. It’s equal to the number of cells minus one. Test the hypothesis. Use your chi-square statistic to find the P-value. (Remember, you’ll always have a one-sided test.) Large chi-square values mean lots of deviation from the hypothesized model, so they give small P-values.

But I Believe the Model… Goodness-of-fit tests are likely to be performed by people who have a theory of what the proportions should be, and who believe their theory to be true. Unfortunately, the only null hypothesis available for a goodness-of-fit test is that the theory is true. As we know, the hypothesis testing procedure allows us only to reject or fail to reject the null.

But I Believe the Model… (cont.) We can never confirm that a theory is in fact true. At best, we can point out only that the data are consistent with the proposed theory. Remember, it’s that idea of “not guilty” versus “innocent.”

Comparing Observed Distributions A test comparing the distribution of counts for two or more groups on the same categorical variable is called a chi-square test of homogeneity. A test of homogeneity is actually the generalization of the two-proportion z-test.

Comparing Observed Distributions (cont.) The statistic that we calculate for this test is identical to the chi-square statistic for goodness-of-fit. In this test, however, we ask whether choices have changed (i.e., there is no model). The expected counts are found directly from the data and we have different degrees of freedom.

Assumptions and Conditions The assumptions and conditions are the same as for the chi-square goodness-of-fit test: Counted Data Condition: The data must be counts. Randomization Condition and 10% Condition: As long as we don’t want to generalize, we don’t have to check these condition. Expected Cell Frequency Condition: The expected count in each cell must be at least 5.

Calculations To find the expected counts, we multiply the row total by the column total and divide by the grand total. We calculated the chi-square statistic as we did in the goodness-of-fit test: In this situation we have (R – 1)(C – 1) degrees of freedom, where R is the number of rows and C is the number of columns. We’ll need the degrees of freedom to find a P-value for the chi-square statistic.

Examining the Residuals When we reject the null hypothesis, it’s always a good idea to examine residuals. For chi-square tests, we want to work with standardized residuals, since we want to compare residuals for cells that may have very different counts. To standardize a cell’s residual, we just divide by the square root of its expected value:

Examining the Residuals (cont.) These standardized residuals are just the square roots of the components we calculated for each cell, with the + or the – sign indicating whether we observed more cases than we expected, or fewer. The standardized residuals give us a chance to think about the underlying patterns and to consider the ways in which the distribution may have changed from class to class.

Independence Contingency tables categorize counts on two (or more) variables so that we can see whether the distribution of counts on one variable is contingent on the other. A test of whether the two categorical variables are independent examines the distribution of counts for one group of individuals classified according to both variables in a contingency table. A chi-square test of independence uses the same calculation as a test of homogeneity.

Assumptions and Conditions We still need counts and enough data so that the expected values are at least 5 in each cell. If we’re interested in the independence of variables, we usually want to generalize from the data to some population. In that case, we’ll need to check that the data are a representative random sample from that population.

Examine the Residuals Each cell of a contingency table contributes a term to the chi-square sum. It helps to examine the standardized residuals, just like we did for tests of homogeneity.

Chi-Square and Causation Chi-square tests are common, and tests for independence are especially widespread. We need to remember that a small P-value is not proof of causation. Since the chi-square test for independence treats the two variables symmetrically, we cannot differentiate the direction of any possible causation even if it existed. And, there’s never any way to eliminate the possibility that a lurking variable is responsible for the lack of independence.

Chi-Square and Causation (cont.) In some ways, a failure of independence between two categorical variables is less impressive than a strong, consistent, linear association between quantitative variables. Two categorical variables can fail the test of independence in many ways. Examining the standardized residuals can help you think about the underlying patterns.

What Can Go Wrong? Don’t use chi-square methods unless you have counts. Just because numbers are in a two-way table doesn’t make them suitable for chi-square analysis. Beware large samples. With a sufficiently large sample size, a chi-square test can always reject the null hypothesis. Don’t say that one variable “depends” on the other just because they’re not independent. Association is not causation.

What have we learned? We’ve learned how to test hypotheses about categorical variables. All three methods we examined look at counts of data in categories and rely on chi-square models. Goodness-of-fit tests compare the observed distribution of a single categorical variable to an expected distribution based on theory or model. Tests of homogeneity compare the distribution of several groups for the same categorical variable. Tests of independence examine counts from a single group for evidence of an association between two categorical variables.

What have we learned? (cont.) Mechanically, these tests are almost identical. While the tests appear to be one-sided, conceptually they are many-sided, because there are many ways that the data can deviate significantly from what we hypothesize. When we reject the null hypothesis, we know to examine standardized residuals to better understand the patterns in the data.