Newsom USP 534 Data Analysis Spring 2006 Simple Within-Subjects Tests Within-subjects t-test The within-subjects t-test, used for comparisons with a continuous dependent variable, is also known as the paired samples t-test (the SPSS term), the dependent samples t-test, correlated samples t-test, or the repeated measures t-test. The reason the test has all of these names is because it is used in several different situations: the same person is in the study twice (longitudinal or repeated measures design), pairs of individuals are linked together or “yoked” (e.g., twins, or married couples), or because they are naturally linked or the experimenter linked them as when they are ‘matched’ on some score (e.g., matched on age). Example. We could have conducted the same school privatization (charter) study in a different way—by comparing teachers’ satisfaction ratings before and after a school was converted to a privately operated school. This design could be classified as a single-group pretest-posttest design (Remember from our design discussion that there are some methodological problems with this design that can be addressed with some changes, but let’s just assume this is the design for now). Using the same numbers as in the first between-subjects example given in class, we have two scores for each of 5 teachers. However, notice that in this design we only are using half the number of cases. Teacher Public (Pretest) 2 4 6 8 10 1 2 3 4 5 Private (Posttest) 7 8 10 8 12 D DD -5 -4 -4 0 -2 D 3 2 1 1 3 1 D D D D 2 4 1 1 9 1 2 16 Formulas: s 2 D D D 2 sD sD2 N t D sD N 1 3 16 4 3.35 .89 4 5 4 .89 df = N-1 = 5-1 = 4. tcrit at a = .05 with df = 4 is 2.776. The difference is significant, because the (absolute value of the) calculated value, 3.35, exceeds the critical value of 2.776. Statistical comment. Notice that the same data in the very first between-subjects example (presented in class) yielded a non-significant difference (with twice as many cases!!). The reason the within-subjects test has more powerful is that variation due to individual differences is eliminated in the within-subjects design. Each subject serves as his/her own comparison or control. Newsom USP 534 Data Analysis Spring 2006 SPSS Menus Steps 1. Analyze Compare Means Paired Samples t-test 2. Move over the two variables (e.g., pretest score variable, posttest score variable) 3. Click “Ok.” The Output will look something like this (note that this was generated in SPSS 11.5): SPSS Output Paired Samples Statistics Mean Pair 1 PUBLIC rating of public school PRIVATIZ rating of privatized s chool N Std. Deviation Std. Error Mean 6.0000 5 3.16228 1.41421 9.0000 5 2.00000 .89443 Paired Samples Correlations N Pair 1 PUBLIC rating of public school & PRIVATIZ rating of privatized school Correlation 5 .791 Sig. .111 Pa ired Sa mpl es Test Paired Differences Mean Pair 1 PUBLIC rating of public sc hool - PRIVATIZ rating of privatized sc hool -3. 0000 St d. Deviat ion St d. Error Mean 2.00000 .89443 95% Confidenc e Int erval of t he Difference Lower Upper -5. 4833 -.5167 t -3. 354 df Sig. (2-tailed) 4 Example write-up. Using a repeated measures t-test, public school teachers’ satisfaction ratings prior to privatization of their school were compared to their satisfaction ratings after privatization of their school. Satisfaction ratings were significantly lower after privatization (M = 6) than before privatization (M = 9) as indicated by a significant t-test, t(4) = 3.35, p < .05. This finding indicates that there was a decline in satisfaction ratings over time that was not likely to be due to chance. .028 Newsom USP 534 Data Analysis Spring 2006 Chi-square for within-subjects For a binary dependent variable, there is a form of the chi-square test for within-subjects designs called McNemar's chi-square. As with the paired t-test or the within-subjects ANOVA, the McNemar test is used whenever the same individuals are measured (or surveyed) twice, matched on some variable (e.g., yoked by age), participants are paired in some way (e.g., twins or married couples), or responses on two measures are used (e.g., favorability to gun control compared to favorability for abolishing the second amendment). For instance, we might examine the favorability of voters for gun control legislation in April and in June. June April No 80 10 90 No Yes Yes 100 110 210 180 120 300 To compute McNemar's, the following formula is used: bc bg 2 McNemar ' s 2 cb c, b, and d come from labeling the cells in the table as below. June April No Yes No a c Yes b d b10 100g 2 100 10 b90g 2 110 73.63 df in this test is 1, the critical value is 3.84 (from the chi-square table), and because calculated value of 73.63 exceeds this value, there is a significant difference in April and June responses. For more than 2 related groups, one can use Cochran’s Q test, which I will not detail here. Newsom USP 534 Data Analysis Spring 2006 SPSS Menus Steps for McNemar’s test 1. Analyze Descriptive statistics Crosstabs 2. Move over the two variables to the row and column boxes (I used rows for the pretest and columns for the posttest) 3. Click on Statistics and check McNemar, then click Continue. 4. Click on Cells and then check Row and Column under Percentages, then click Continue. 5. Click OK. SPSS Output for McNemar’s test April Favor gun legislation in April * June Favor gun legislation in June Crosstabulation April Favor gun legislation in April 1 no 2 yes Total Count % within April Favor gun legislation in April % within June Favor gun legislation in June Count % within April Favor gun legislation in April % within June Favor gun legislation in June Count % within April Favor gun legislation in April % within June Favor gun legislation in June June Favor gun legislation in June 1 no 2 yes 80 100 Total 180 44.4% 55.6% 100.0% 88.9% 47.6% 60.0% 10 110 120 8.3% 91.7% 100.0% 11.1% 52.4% 40.0% 90 210 300 30.0% 70.0% 100.0% 100.0% 100.0% 100.0% Chi-Square Tests Value McNemar Test N of Valid Cases Exact Sig. (2-sided) .000a 300 a. Binomial distribution us ed. Voter favorability toward the gun control measure changed significantly over the two-month period (p < .001). Voters were more likely to favor the gun control legislation in June (70%) than in April (40%) when they were first polled. (Note that SPSS does not give the value of the McNemar chi-square, just it’s p-value. Also, in this case, it make more sense to use the marginal total percentages rather than the percentages within particular cells.)