Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 1 T-tests and their Nonparametric Analogs.

Similar presentations


Presentation on theme: "Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 1 T-tests and their Nonparametric Analogs."— Presentation transcript:

1 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 1 T-tests and their Nonparametric Analogs

2 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 2 Decoding Terminology  “T-test”  Type of Hypothesis Test  Inference on Normally distributed population means  One-sample case last week, Two-sample tonight…  “Nonparametric Analogs”  Both one and two-sample hypothesis tests for data coming from a population that is NOT normal.

3 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 3 The Big Picture Populations and Samples Sample / Statistics x, s, s 2 Population Parameters μ, σ, σ 2

4 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 4 What is a Parameter?  Parameter = a characteristic of the population in which we have a particular interest  Examples: μ, σ, σ 2, ρ  Statistical tests that assume an underlying distribution (“parametric”) use parameters  For the Normal data, knowing just two parameters, µ and σ, allows you to fully describe a unique distribution – and therefore, calculate probabilities  Statistical tests not relying on an underlying distribution (“nonparametric”) don’t necessitate parameters

5 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 5 Other Considerations:  One or Two-sided Hypothesis? Hypothesis Testing Tree

6 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 6 Hypothesis Testing Steps 1.State H 0 (i.e., what you are trying to disprove) 2.State H A 3.Determine α (at your discretion) 4.Determine the test statistic and associated p-value 5.Determine whether to reject H 0 or fail to reject H 0

7 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 7 One-Sample T-test Review 1.H 0 : μ = μ 0 2.H A : μ ≠ μ 0 or μ > μ 0 or μ < μ 0 3.α typically set at 0.05 4.Test Statistic: P-value 5.Conclusion – Reject or Fail to Reject H 0 ? Assumptions:  Random (valid) sampling  Data comes from a population that is normally distributed

8 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 8 Comparing Two Samples Populations μ 1 μ 2 Sampling Distributions of x n1n1 n2n2 x1x1 (x 1 -x 2 ) x2x2 (μ1-μ2)(μ1-μ2) Sampling Distribution of x 1 -x 2

9 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 9 Comparing Two Samples  Are the two samples independent?  Are standard deviations, σ 1 and σ 2, significantly different? Group 1Group 2 PopulationMeanμ1μ1 μ2μ2 Std. deviationσ1σ1 σ2σ2 SampleMean Std. deviation x1s1x1s1 x2s2x2s2 Sample sizen1n1 n2n2

10 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 10 Comparing Two Independent Samples

11 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 11 Comparing Two Independent Samples In the case of two independent samples consider the following issues: 1.The two sets of measurements are independent because each comes from a different group (e.g., healthy children, children suffering from cystic fibrosis). 2. In contrast to the one-sample case, we are simultaneously estimating two population means instead of one. Thus, there are now two sources of variability instead of one (one from each sample) instead of just one as was the case in the one-sample tests. As a result, the standard deviation is going to be roughly double (!) compared to the one-sample case.

12 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 12 Comparing Two Independent Samples The following assumptions must hold: a.The two samples must be independent from each other b.The individual measurements must be roughly normally distributed c.The variances in the two populations must be roughly equal If a-c are satisfied, inference will be based on the statistic, distributed according to a t distribution with n 1 +n 2 -2 degrees of freedom.

13 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 13 Comparing Two Independent Samples STEP 1. Based on two random samples of size n 1 and n 2 observations compute the sample means x 1 and x 2, and the std. deviations and STEP 2. Compute the pooled estimate of the population variance STEP 3. The estimate of the standard deviation is.

14 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 14 Comparing Two Independent Samples  Back to our example of Serum iron levels and cystic fibrosis …

15 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 15 Comparing Two Independent Samples

16 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 16 Comparing Two Independent Samples

17 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 17 Comparing Two Independent Samples

18 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 18 Comparing Two Independent Samples  What if the two samples had significantly different variances?  First, calculate t:  Approximate distribution with v:  Now, compare value of statistic to t distribution with v degrees of freedom.

19 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 19 Two-sample Confidence Intervals  Hypothesis Testing // Interval Estimation  Values between the CI limits are values for which the null hypothesis would not be rejected Note that these critical values change depending on t-distribution (# of df’s)

20 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 20 Two-sample Confidence Intervals  Two-sided confidence interval for the difference in two means: (μ 1 - μ 2 ) 2.5%

21 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 21 Two-sample Confidence Intervals  Back to our example…

22 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 22 Two-sample Confidence Intervals

23 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 23 Two-sample Confidence Intervals  In our example…

24 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 24 Two-sample Confidence Intervals

25 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 25 Two-sample Confidence Intervals

26 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 26 Two-sample Confidence Intervals 1.4 2.4 7.0 12.6 2.5% 5%  Two-sided confidence interval: (1.4, 12.6)  One-sided confidence interval: (2.4, + infinity)  Both centered at 7.0 (mean difference)

27 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 27  If our data had significantly different variances, the CI equation would change:  Now the variances of both samples taken into account.  Again, based on a t-distribution with v d.f. Two-sample Confidence Intervals

28 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 28 CHD Example  Effects of Hormone Replacement Therapy on Serum Lipids in Elderly Women Annals of Internal Medicine (134:754-760, 2001)  Coronary heart disease (CHD) is the leading cause of death among older women. Low levels of HDL are a risk factor for death from CHD. Researchers claim that hormone replacement therapy can increase HDL, thus hopefully preventing CHD.

29 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 29 CHD Example  63 women were randomized in a double-blinded fashion to one of two groups (experimental or placebo arm). Four women were excluded from our analysis because lipid-lowering medication dosage was not stable during the study period (2 each in the placebo and HRT groups). Therefore, we analyzed data on 59 participants: 20 in the placebo group and 39 in the HRT group. Population (Elderly Women) HRT (n=39) Placebo (n=20)

30 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 30 CHD Example 2-sample (independent) t-test. Hypotheses: H0: μ Experimental ≤ μ Placebo HA: μ Experimental > μ Placebo Critical Value: t 0.01 = 2.394 (using 57 df)

31 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 31 CHD Example Remember: & Test Statistic: Conclusion:  Reject H 0. There is sufficient evidence to conclude that the mean increase in HDL levels of women in the treatment group is greater than the mean increase in HDL levels of women in the control group.

32 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 32 Independent vs. Dependent  Independent: One set of data tells us nothing about values in another set of data.  Dependent (Paired): For each observation in group 1, there is a corresponding observation in group 2.  Before/After measures, sets of twins, etc.  Key is that all variables, other than what we are interested in, are controlled for between samples (i.e. age, sex,…)

33 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 33 Comparing Paired Samples

34 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 34 Comparing Paired Samples

35 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 35 Comparing Paired Samples  Hypothesis testing for paired samples:

36 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 36 Comparing Paired Samples  Note that we can think of the paired t-test as a case of a one-sample t-test based on the differences, d.

37 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 37 Comparing Paired Samples

38 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 38 Comparing Paired Samples

39 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 39 Comparing Paired Samples Since P<t=0.0059<0.05, we reject the null hypothesis. Patients experience angina faster (by about 6.63%) when breathing air mixed with CO then when breathing clean air. To carry out the above test of hypothesis by STATA we use the one- sample t-test command as before, noting that our data are now comprised by differences of the paired observations and the mean under the null hypothesis is zero. The output is as follows:

40 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 40 Confidence Intervals - Paired  Again, this is equivalent to the case of a one- sample t-test, but now based on the mean differences, d, rather than x.

41 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 41 Covered so far…

42 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 42  What kind of data is “nonparametric”?  Not defined by a distribution (i.e. Normal), rather defined by the data itself.  What does it look like?  Examples: Skewed, bimodal, ordinal data  Examples  Pain/severity scales  Performance ratings The World is Not Always Normal!

43 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 43 Need more Branches… Population ParametricNonparametric One Sample Sign Test Wilcoxon Signed-Rank Test Two Sample Independent Wilcoxon Rank-Sum Test Dependent (Paired) Sign Test Wilcoxon Signed-Rank Test

44 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 44 Nonparametric Analogs SituationParametric TestNonparametric Test(s) 1-sample1-sample t-test  Sign test  Wilcoxon signed-rank test 2-sample (independent) 2-sample t-test (independent)  Wilcoxon rank-sum test (aka Mann- Whitney) 2-sample (dependent) Paired t-test  Sign test  Wilcoxon signed-rank test Note: Nonparametric tests do not require normality (or any distributional assumption). Thus, they are often called “distribution-free”. However, the two-sample tests require equal variances.

45 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 45 Nonparametric Tests  Advantages  Don’t need to assume the data come from a specified distribution (i.e. Normal)  Don’t need to use parameters  Can be quick and easy!  Disadvantages  We may not do as well as the parametric approach if the data do come from a parametric population (less “power”)  Hard to make quantitative statements about differences  If large sample size (even if not Normal data), should apply CLT

46 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 46 Nonparametric Tests  Assign, and use, ranks instead of raw data in tests  e.g. Test scores: 67, 58, 89, 91, 91, 96 Ranked: 1, 2, 3, 4.5, 4.5, 6  H o : Medians are equal  Sign Tests only account for whether a rank is less than, equal to, or greater than another rank  Wilcoxon Signed-Rank and Rank-Sum tests account for the relative magnitude of these differences in ranks

47 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 47 Sign Test  One Sample  Categorize each value as above or below hypothesized median  Test relative number +/-  Two Samples  Take signs of the differences (+/-) in paired samples  Test equal number of signs in each group

48 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 48 Sunblock Experiment  Testing a new lotion… Spread the lotion on one (random arm) of friends on the beach and spread the placebo cream on the other arm. Of course, we ensure they perform proper rotations with the sun for even sun…  After two hours of sunbathing, we check their arms and note which one was more red.  H 0 : No difference in sunburn between lotion and placebo

49 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 49 Sunblock Experiment LotionPlacebo Triin-+ Audrey+- Tzu-Min-+ Yu-+ Katie-+ Scott00

50 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 50 Sunblock Experiment. signtest lotion=placebo Sign test sign | observed expected -------------+------------------------ positive | 1 2.5 negative | 4 2.5 zero | 1 1 -------------+------------------------ all | 6 6 Two-sided test: Ho: median of lotion - placebo = 0 vs. Ha: median of lotion - placebo != 0 Pr(#positive >= 4 or #negative >= 4) = min(1, 2*Binomial(n = 5, x >= 4, p = 0.5)) = 0.3750  Note that we have a small sample size (n=5)  We may not be able to make normality assumptions for Z +, so exact methods are used  Binomial distribution covered later in the course)

51 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 51 Wilcoxon Signed-Rank Test  Sign Test can be very wasteful of information  Wilcoxon tests account for difference in relative magnitude between groups  In our example, burns graded on a 0-5 scale (0=no burn, 5=severe burn)  Rank data, and add signs

52 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 52 Sunblock Experiment LotionPlaceboAbs(diff), Rank and Sign Triin154, 3.5 (-) Audrey321, 1 (+) Tzu-Min055, 5 (-) Yu242, 2 (-) Katie044, 3.5 (-) Scott330 (0)

53 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 53 Sunblock Experiment  Now, sum up ranks corresponding to “+” and “-” signs:  T + = 1  T - = 14  If no difference, would expect equal number (i.e. T + = T - )  Significant difference?

54 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 54 Sunblock Experiment. signrank lotion=placebo Wilcoxon signed-rank test sign | obs sum ranks expected -------------+--------------------------------- positive | 1 2 10 negative | 4 18 10 zero | 1 1 1 -------------+--------------------------------- all | 6 21 21 unadjusted variance 22.75 adjustment for ties -0.13 adjustment for zeros -0.25 ---------- adjusted variance 22.38 Ho: lotion = placebo z = -1.691 Prob > |z| = 0.0908 Again, note small n Table A.6 provides exact p-values Looking here… Sample Size=5 and T 0 =1, so p=2(0.0623)=0.125

55 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 55 Wilcoxon Rank-Sum Test  Testing for difference in two independent samples (aka Mann- Whitney)  H 0 : The two populations have the same probability distribution  Rank all data together, regardless of group  Sum ranks in one group – extreme?

56 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 56 Caffeine and Memory  Two independent groups of ten individuals  10 given a grande cup of Starbucks coffee  10 given a grande cup of decaf Starbucks coffee  How many of 20 objects in memory test recollected?

57 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 57 Caffeine and Memory Caffeinated 1810171815201271710 Decaf 91412195101115611  Rank all 20 scores:  5 6 7 9 10 10 10 11 11 12 12 14 15 15 17 17 18 18 19 20  1 2 3 4 6 6 6 8.5 8.5 10.5 10.5 12 13.5 13.5 15.5 15.5 17.5 17.5 19 20  Sum Caffeinated Ranks:  3+6+6+10.5+13.5+15.5+15.5+17.5+17.5+20 = 125

58 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 58 Caffeine and Memory. ranksum score, by(caf) Two-sample Wilcoxon rank-sum (Mann-Whitney) test caf | obs rank sum expected -------------+--------------------------------- 0 | 10 85 105 1 | 10 125 105 -------------+--------------------------------- combined | 20 210 210 unadjusted variance 175.00 adjustment for ties -1.18 ---------- adjusted variance 173.82 Ho: score(caf==0) = score(caf==1) z = -1.517 Prob > |z| = 0.1293

59 Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 59 Hypothesis Tests Review Population Parametric One Sample Z-Test (σ known) One Sample T-Test Two Samples Independent 2-Sample T-test w/ Equal Variances w/ Unequal Variances Dependent Paired T-test Nonparametric One Sample Sign Test Wilcoxon Signed- Rank Test Two Samples Independent Wilcoxon Rank- Sum Test Dependent (Paired) Sign Test Wilcoxon Signed- Rank Test


Download ppt "Introduction to Biostatistics, Harvard Extension School © Scott Evans, Ph.D. and Lynne Peeples, M.S. 1 T-tests and their Nonparametric Analogs."

Similar presentations


Ads by Google