Two Sample Hypothesis Testing (paired t-test) PHOP 6372: Two Sample Hypothesis Testing (paired t-test)
Objective Understand how to conduct a paired t-test Understand the relationship between a paired (dependent) t-test and a one-sample t-test
Examples of Paired Data Two measurements on the same person pretest, posttest crossover studies differences between left eye, right eye Matched pairs Differences between spouses in same couples Key issue: the measurements are not independent.
Paired Sample Analysis Equivalent to an analysis of differences A paired-sample t-test is in fact a one-sample t-test of differences between items in the same pair.
Illustration 2 variables x1 and x2 with means μ1 and μ2 Example: weight gain of people on vacation x1: weight at beginning of vacation x2: weight at end of vacation x2 – x1: weight gain The mean of x2 – x1 Δ = μ2 – μ1 H0: μ1 = μ2 which is equivalent to H0: Δ = 0 H1 can be 1-tailed or 2-tailed.
Illustration Observation (i) x1 x2 d=x2-x1 1 x11 x12 d1=x12-x11 2 x21 3 x31 x32 d3=x32-x31 … … … n xn1 xn2 dn=xn2-xn1
Formula Test statistic: Thresholds: t > tn-1,1-α t < -tn-1,1-α t > tn-1,1-α/2 or t < -tn-1,1-α/2
Exercise Suppose a sample of n students were given a diagnostic test before studying a particular module and then again after completing the module. We want to find out if, in general, how our teaching affects students’ knowledge/skills (i.e. test scores). We can use the results from our sample of students to draw conclusions about the impact of the module in general. Let’s conduct a two-sample two-sided test. Student Pre-module score Post-module score difference 1 18 22 4 2 21 25 3 16 17 . 19 15 20 -1
Recall Hypothesis Testing Steps Set up null hypothesis (H0) and alternative hypothesis (H1 or HA) Choose a test statistic Choose significance level (), i.e. type I error rate Determine rejection region Reject H0 if test statistic falls in rejection region
Example H0: μd = 0 H1: μd ≠ 0 We hope to find evidence to reject H1. We will look at the sample mean , the average difference in our data. If is substantially different than 0, we will conclude that μd ≠ 0.
Example (cont.) H0: μd = 0 H1: μd ≠ 0 Choose α = 0.05 Then the rejection region is t > t20-1,1-0.05 = 1.729 Test statistic t is in the rejection region reject H0
Critical region for previous example twoway function y=tden(19,x), range(-3 3) droplines(0, 1.729) xlabel(-3(1)3) title(Student's t-distribution with 19 df)
Stata outputs-data example gen diff= postmod-premod graph box diff sktest diff Reasonably normal to continue with t-test
Stata outputs summarize diff ttest diff=0 The two-sided p value is 0.0044. Therefore, there is strong evidence to reject the null hypothesis. he difference in running time between the two computers is not statistically significant.