Module 9: Nonparametric Statistics Statistics (OA3102)

Similar documents
Non-Parametric Statistics: When Normal Isn t Good Enough"

Chapter 15: Nonparametric Statistics Section 15.1: An Overview of Nonparametric Statistics

Non-parametric methods

Non-parametric tests, part A:

Nonparametric Statistics

Module 10: Analysis of Categorical Data Statistics (OA3102)

Distribution-Free Procedures (Devore Chapter Fifteen)

CHAPTER 17 CHI-SQUARE AND OTHER NONPARAMETRIC TESTS FROM: PAGANO, R. R. (2007)

Unit 14: Nonparametric Statistical Methods

PSY 307 Statistics for the Behavioral Sciences. Chapter 20 Tests for Ranked Data, Choosing Statistical Tests

STAT 135 Lab 8 Hypothesis Testing Review, Mann-Whitney Test by Normal Approximation, and Wilcoxon Signed Rank Test.

Data are sometimes not compatible with the assumptions of parametric statistical tests (i.e. t-test, regression, ANOVA)

Non-parametric (Distribution-free) approaches p188 CN

Introduction and Descriptive Statistics p. 1 Introduction to Statistics p. 3 Statistics, Science, and Observations p. 5 Populations and Samples p.

3. Nonparametric methods

SEVERAL μs AND MEDIANS: MORE ISSUES. Business Statistics

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

Nonparametric Statistics. Leah Wright, Tyler Ross, Taylor Brown

BIO 682 Nonparametric Statistics Spring 2010

Nonparametric statistic methods. Waraphon Phimpraphai DVM, PhD Department of Veterinary Public Health

Nonparametric Tests. Mathematics 47: Lecture 25. Dan Sloughter. Furman University. April 20, 2006

Lecture 7: Hypothesis Testing and ANOVA

Business Statistics MEDIAN: NON- PARAMETRIC TESTS

Fish SR P Diff Sgn rank Fish SR P Diff Sng rank

ST4241 Design and Analysis of Clinical Trials Lecture 9: N. Lecture 9: Non-parametric procedures for CRBD

4/6/16. Non-parametric Test. Overview. Stephen Opiyo. Distinguish Parametric and Nonparametric Test Procedures

TMA4255 Applied Statistics V2016 (23)

Hypothesis Testing. Hypothesis: conjecture, proposition or statement based on published literature, data, or a theory that may or may not be true

Non-parametric Tests

Inferential Statistics

Solutions exercises of Chapter 7

Nonparametric tests. Mark Muldoon School of Mathematics, University of Manchester. Mark Muldoon, November 8, 2005 Nonparametric tests - p.

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

Business Statistics. Lecture 10: Course Review

HYPOTHESIS TESTING II TESTS ON MEANS. Sorana D. Bolboacă

Dr. Maddah ENMG 617 EM Statistics 10/12/12. Nonparametric Statistics (Chapter 16, Hines)

Introduction to Nonparametric Statistics

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

Wilcoxon Test and Calculating Sample Sizes

ST4241 Design and Analysis of Clinical Trials Lecture 7: N. Lecture 7: Non-parametric tests for PDG data

Analysis of variance (ANOVA) Comparing the means of more than two groups

Module 6: Methods of Point Estimation Statistics (OA3102)

6 Single Sample Methods for a Location Parameter

Nonparametric tests. Timothy Hanson. Department of Statistics, University of South Carolina. Stat 704: Data Analysis I

THE ROYAL STATISTICAL SOCIETY HIGHER CERTIFICATE

STATISTIKA INDUSTRI 2 TIN 4004

Non-parametric Hypothesis Testing

ANOVA - analysis of variance - used to compare the means of several populations.

Rank-Based Methods. Lukas Meier

Lecture 10: Non- parametric Comparison of Loca6on. GENOME 560, Spring 2015 Doug Fowler, GS

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

Introduction to Statistical Analysis

1 ONE SAMPLE TEST FOR MEDIAN: THE SIGN TEST

Chapter 7 Comparison of two independent samples

What is a Hypothesis?

Data analysis and Geostatistics - lecture VII

Mitosis Data Analysis: Testing Statistical Hypotheses By Dana Krempels, Ph.D. and Steven Green, Ph.D.

Agonistic Display in Betta splendens: Data Analysis I. Betta splendens Research: Parametric or Non-parametric Data?

Chapter 18 Resampling and Nonparametric Approaches To Data

Parametric versus Nonparametric Statistics-when to use them and which is more powerful? Dr Mahmoud Alhussami

S D / n t n 1 The paediatrician observes 3 =

Frequency table: Var2 (Spreadsheet1) Count Cumulative Percent Cumulative From To. Percent <x<=

Comparison of Two Population Means

Lecture Slides. Elementary Statistics. by Mario F. Triola. and the Triola Statistics Series

Inferences About the Difference Between Two Means

Textbook Examples of. SPSS Procedure

Statistical Procedures for Testing Homogeneity of Water Quality Parameters

Lecture Slides. Section 13-1 Overview. Elementary Statistics Tenth Edition. Chapter 13 Nonparametric Statistics. by Mario F.

Summary of Chapters 7-9

Conditioning Nonparametric null hypotheses Permutation testing. Permutation tests. Patrick Breheny. October 5. STA 621: Nonparametric Statistics

Intuitive Biostatistics: Choosing a statistical test

Data Analysis: Agonistic Display in Betta splendens I. Betta splendens Research: Parametric or Non-parametric Data?

DETAILED CONTENTS PART I INTRODUCTION AND DESCRIPTIVE STATISTICS. 1. Introduction to Statistics

What to do today (Nov 22, 2018)?

Nonparametric Location Tests: k-sample

NON-PARAMETRIC STATISTICS * (

Glossary. The ISI glossary of statistical terms provides definitions in a number of different languages:

= 1 i. normal approximation to χ 2 df > df

Selection should be based on the desired biological interpretation!

STAT 135 Lab 9 Multiple Testing, One-Way ANOVA and Kruskal-Wallis

Introduction to Survey Analysis!

An Analysis of College Algebra Exam Scores December 14, James D Jones Math Section 01

Do not copy, post, or distribute. Independent-Samples t Test and Mann- C h a p t e r 13

GROUPED DATA E.G. FOR SAMPLE OF RAW DATA (E.G. 4, 12, 7, 5, MEAN G x / n STANDARD DEVIATION MEDIAN AND QUARTILES STANDARD DEVIATION

PHP2510: Principles of Biostatistics & Data Analysis. Lecture X: Hypothesis testing. PHP 2510 Lec 10: Hypothesis testing 1

z and t tests for the mean of a normal distribution Confidence intervals for the mean Binomial tests

Contents. Acknowledgments. xix

Introduction to Crossover Trials

Comparison of Two Samples

Statistical Inference Theory Lesson 46 Non-parametric Statistics

Physics 509: Non-Parametric Statistics and Correlation Testing

Glossary for the Triola Statistics Series

Biostatistics 270 Kruskal-Wallis Test 1. Kruskal-Wallis Test

Analyzing Small Sample Experimental Data

Lecture 26. December 19, Department of Biostatistics Johns Hopkins Bloomberg School of Public Health Johns Hopkins University.

Data Analysis and Statistical Methods Statistics 651

Hypothesis testing, part 2. With some material from Howard Seltman, Blase Ur, Bilge Mutlu, Vibha Sazawal

Formulas and Tables by Mario F. Triola

Visual interpretation with normal approximation

MATH Notebook 3 Spring 2018

Transcription:

Module 9: Nonparametric Statistics Statistics (OA3102) Professor Ron Fricker Naval Postgraduate School Monterey, California Reading assignment: WM&S chapter 15.1-15.6 Revision: 3-12 1

Goals for this Lecture Discuss advantages and disadvantages of nonparametric tests General two-sample shift model Nonparametric tests for paired data Sign test Wilcoxon signed-rank test Small and large sample variants Nonparametric tests for two-samples of independent data Wilcoxon rank sum test Mann-Whitney U test Revision: 3-12 2

Challenges in Hypothesis Testing Some experiments give responses they defy exact quantification Rank the utility of four weapons systems Gives an ordering, but can be impossible to say things like System A is twice as useful as B Compare two LVS maintenance programs If the data clearly do not fit the assumptions of the (parametric) tests we have learned, what to do? Nonparametric tests may be the solution Revision: 3-12 3

Parametric vs. Nonparametric Parametric hypothesis testing: Statistic distribution are specified (often normal) Often follows from Central Limit Theorem, but sometimes CLT assumptions don t fit/apply Nonparametric hypothesis testing: Does not assume a particular probability distribution Often called distribution free Generally based on ordering or order statistics Revision: 3-12 4

Advantages of Nonparametric Tests Tests make less stringent demands on the data E.g., they require fewer assumptions Usually require independent observations Sometimes assume continuity of the measure Can be more appropriate: When measures are not precise For ordinal data where scale is not obvious When only ordering of data is available Revision: 3-12 5

Disadvantages of Nonparametric Tests They may throw away information E.g., Sign tests only looks at the signs (+ or -) of the data, not the numeric values If the other information is available and there is an appropriate parametric test, that test will be more powerful The trade-off: Parametric tests are more powerful if the assumptions are met Nonparametric tests provide a more general result if they are powerful enough to reject Revision: 3-12 6

A General Two-Sample Shift Model Consider two independent samples of data, X1,..., X n and Y, taken from normal 1 1,..., Yn 2 populations with means m X and m Y and equal variances Then we may wish to test H : 0 m 0 vs. : 0 X my Ha mx my This is a two-sample parametric shift (or location) model Parametric as the distribution is specified (normal) All is known except m X and m Y (and perhaps s 2 ) Revision: 3-12 7

Now, Generalizing to a Nonparametric Shift Model Let X,..., be a random sample from a 1 Xn 1 population with distribution function F(x) Let Y,..., 1 Yn 2 be a random sample from a population with distribution function G(y) Consider testing the hypotheses that the two distributions are the same, H : 0 F ( z ) G ( z ) vs. H : ( ) ( ) a F z G z where the form of the distributions is unspecified A nonparametric approach now clearly required Revision: 3-12 8

Generalizing to a Nonparametric Shift Model (continued) Notice that the hypotheses H : 0 F ( z ) G ( z ) vs. H : ( ) ( ) a F z G z are very broad It just says the two distributions are different Often experimenters want to test something more specific, such as the distributions differ by location E.g., G( y) =Pr( Y y)=pr( X y ) F( y ) See Figure 15.2 in the text for an illustration Revision: 3-12 9

Generalizing to a Nonparametric Shift Model (continued) Throughout the rest of the module, a twosample shift (or location) model means: X,..., 1 Xn 1 is a random sample from F(x), and Y,..., 1 Yn 2 is a random sample from G(y)=F(y- ) for some unknown value For the two-sample shift model, we can then think of the hypotheses as H : 0 vs. : 0 0 H a Can also test for alternatives H a : 0 or H : 0 a Revision: 3-12 10

Introduction to the Sign Test for a Matched Pairs Experiment Suppose there are n pairs of observations in the form (X i, Y i ) We wish to test the hypothesis that the distribution of the Xs and Ys is the same except perhaps for the location One of the simplest nonparametric tests is called the sign test Idea: Define D i = X i Y i. Then under the null hypothesis, the probability that D i is positive is 0.5 Revision: 3-12 11

Sign Test for Matched Pairs Let p=pr(x > Y) The null hypothesis is The test statistic is H : p1/ 2 0 Three possible alternative hypotheses and tests: M # D i 0 Alternative Hypothesis H : 1/ 2 a p H : 1/ 2 a p H : 1/ 2 a p M M Rejection Region c c M n c or M c (upper-tailed test) (lower-tailed test) (two-tailed test) Revision: 3-12 12

Example 15.1 Number of defective electrical fuses for each of two production lines recorded daily for 10 days Is there sufficient evidence to say that one line produces more defectives than the other? Write out the hypotheses: Revision: 3-12 13

Example 15.1 (continued) Now, calculate the test statistic: Day A B 1 172 201 2 165 179 3 206 159 4 184 192 5 174 177 6 142 170 7 190 182 8 169 179 9 161 169 10 200 201 Revision: 3-12 14

Example 15.1 (continued) And now determine the rejection region for a test of level 0.05 < a < 0.1 Revision: 3-12 15

Example 15.1 (continued) And, finally, conduct the test What do you conclude? Revision: 3-12 16

Example 15.2 Find the p-value for the test in Example 15.1 Revision: 3-12 17

In R This is simply a binomial problem We re asking the question: What s the chance of seeing only 2 successes out of 10 trials if p=0.5? Use the binom.test function: Revision: 3-12 18

An Aside: A Parametric Test, the Paired t-test Revision: 3-12 19

The Aside (continued) Revision: 3-12 20

Issues and Variants The sign test is actually testing whether the medians of the distributions is equal What to do with ties in the sign test? Just delete them and decrement n appropriately What if n is large (i.e., n > 25 or 30)? Can use the large sample approximation to the binomial with M np M n 2 Z np(1 p) n 2 Revision: 3-12 21

Sign Test for Large Samples (n > 25) Let p=pr(x > Y) The null hypothesis is The test statistic is H : p1/ 2 0 Z M n 2 0.5 n Three possible alternative hypotheses and tests: Alternative Hypothesis H : 1/ 2 a p H : 1/ 2 a p H : 1/ 2 a p Rejection Region for Level a Test z z z a z a z z or z z a/ 2 a/ 2 (upper-tailed test) (lower-tailed test) (two-tailed test) Revision: 3-12 22

Wilcoxon Signed-Rank Test One- or two-sided test for the hypotheses of the means of a paired sample: (X i, Y i ) Unlike the sign test, here we also use the information contained in the magnitude of the differences, D i =Y i X i, i = 1,,n I.e., we ll use the ranks of the absolute values of the differences in the test, not just the signs Hypotheses: H 0 : the distributions of the Xs and Ys are identical H a : the population distributions differ in location (two-tailed) or population distribution for Xs is shifted to the right (one-tailed) 23

Signed-Rank Methodology To conduct the test: For n matched pairs, one observation from each population (X i, Y i ), define D i =Y i X i Compute the signed ranks: R i =sign(d i ) R( D i ) R( D i ) is the rank of D i among the n D i s Give tied observations the average rank If doing the calculation by hand, build a table: i X Y D i =X i Y i D i R( D i ) R i =sign(d i ) R( D i ) 1 2 24

The Test Statistic For a one-sided test: To test if the Xs are shifted to the right of the Ys, use T=T -, the sum of the negative signed ranks To test if the Ys are shifted to the right of the Xs, use T=T +, the sum of the positive signed ranks For a two-sided test, the test statistic is T=min(T +,T - ), the minimum of either the sum of the positive or negative signed ranks 25

The Rejection Region Use Table 9: Revision: 3-12 26

Example 15.3 Because of the variations in ovens, two types of cake mix were tested in six different ovens So, each oven was used to bake each type of mix ( A and B ) It s a paired experimental design (by oven) Using the Wilcoxon signed-rank test, test the hypothesis that there is no difference in the population distribution of cake densities between the two mixes Revision: 3-12 27

Example 15.3 (continued) Calculate the test statistic: Oven (i) Mix A Mix B D i =A i B i D i R( D i ) R i =sign(d i ) R( D i ) 1 0.135 0.129 2 0.102 0.120 3 0.108 0.112 4 0.141 0.152 5 0.131 0.135 6 0.144 0.163 Revision: 3-12 28

Example 15.3 (continued) Determine the test outcome Revision: 3-12 29

Large Sample Wilcoxon Signed-Rank Test When n > 25, can use normal approximation It turns out that nn E T 1 / 4 T nn n Var 1 2 1 / 24 So we can use the test statistic Z ( 1) / 4 T E T T n n Var( T ) n( n 1)(2n 1) / 24 30

Sign Test for Large Samples (n > 25) The null hypothesis is H 0 : population dist'ns the same The test statistic is Z T n( n 1) / 4 n( n 1)(2n 1) / 24 Three possible alternative hypotheses and tests: Alternative Hypothesis Ha : Xs to right of Ys Ha : Xs to left of Ys Rejection Region for Level a Test z z z a z a (upper-tailed test) (lower-tailed test) H a : locations differ z z or z z a/ 2 a/ 2 (two-tailed test) Revision: 3-12 31

Wilcoxon Rank Sum Test Now, consider two independent samples of data, X1,..., X n and Y, where goal is to 1 1,..., Yn 2 test whether population dist ns are the same Idea: Pool the n 1 +n 2 =n observations, rank them in order of magnitude, and then sum their ranks of the Xs and Ys Under the null hypothesis (distributions are the same) the sum of the ranks should be about equal If there is a location shift, one of the sums should be larger Revision: 3-12 32

Wilcoxon Rank Sum Test (cont d) The hypotheses are like before: H 0 : the distributions of the Xs and Ys are identical H a : the population distributions differ in location Either two-tailed or one tailed An equivalent test: Mann-Whitney U test We ll get to that next Revision: 3-12 33

Example 15.4 Four measurements made for bacteria counts per volume for each of two types of cultures ( I and II ): I II 1 27 32 2 31 29 3 26 35 4 25 28 Is there sufficient evidence to indicate a difference in locations? Revision: 3-12 34

Example 15.4 (continued) Calculate the test statistic: Data Ranks I II I 1 27 32 2 31 29 3 26 35 4 25 28 Rank Sum (W) II Revision: 3-12 35

Example 15.4 (continued) And now determine the rejection region Revision: 3-12 36

Example 15.4 (continued) Revision: 3-12 37

Example 15.4 (continued) And, finally, conduct the test What do you conclude? Revision: 3-12 38

The Mann-Whitney U Test As with the Wilcoxon rank sum test, this test is based on two independent samples of data, X,..., X and Y,..., Y 1 n 1 1 2 Again, the goal is to test whether population dist ns are the same Idea: Order the n 1 +n 2 observations and count the number of X observations that are smaller then each of the Y observations n Revision: 3-12 39

Example From Example 15.4, the eight ordered observations are: So: 25 26 27 28 29 31 32 35 x (1) x (2) x (3) y (1) y (2) x (4) y (3) y (4) u 1 =3 since there are three Xs before y (1) u 2 =3 since there are three Xs before y (2) u 3 =4 since there are three Xs before y (3) u 4 =4 since there are three Xs before y (4) And thus U = u 1 +u 2 +u 3 +u 4 = 3+3+4+4 = 14 Revision: 3-12 40

To Test U Use Table 8 to identify the rejection region So, for example, RR={U: U<1} gives an a=0.0286 level one-sided test For a two-sided test, RR={U: U<1 or U>4*4-1=15} Gives an a=2*0.0286= 0.0572 level two-sided test So, for the example, we fail to reject the hypothesis that the distributions are the same Revision: 3-12 41

Mann-Whitney U vs. Rank Sum Test Turns out the two tests are directly related: where n n 1 U n n 1 1 W 1 2 n 1 is the number of X observations n 2 is the number of Y observations W is the rank sum for the Xs So, first calculate the rank sums of the Xs and then calculate U Revision: 3-12 42 2

Some Notes U can take on values 0,1, 2,, n 1 n 2 It s symmetric about n 1 n 2 /2 Pr(U < U 0 ) = Pr(U > n 1 n 2 - U 0 ) Table 8 is set up for n 1 < n 2 So, label the two sets of data appropriately Handle ties by averaging the ranks for the tied observations E.g., if there are three tied observations due to receive ranks 3, 4, and 5, then give all three rank 4 Then the next observation gets rank 6 Revision: 3-12 43

Mann-Whitney U Test The null hypothesis is The test statistic is H 0 : population dist'ns the same Three possible alternative hypotheses and tests: n n 1 1 U n1n 2 W 2 1 Alternative Hypothesis Ha : Xs to right of Ys Ha : Xs to left of Ys U U 0 U n n U Rejection Region 1 2 0 (upper-tailed test) (lower-tailed test) H a : locations differ U U or U n n U 0 1 2 0 (two-tailed test) Revision: 3-12 44

Example 15.5 Conduct the test using n n 1 2 1 1 U n1n 2 W Revision: 3-12 45

Example 15.6 An experiment was conducted to compare the strengths of two types of kraft paper (i.e., cardboard) Standard kraft paper Paper treated with a chemical substance Test the hypothesis of no difference in the distributions of the strength of the papers versus the alternative that the treated paper tends to be stronger Revision: 3-12 46

Example 15.6 (continued) Calculate the test statistic: Standard, I Treated, II 1 1.21 (2) 1.49 (15) 2 1.43 (12) 1.37 (7.5) 3 1.35 (6) 1.67 (20) 4 1.51 (17) 1.50 (16) 5 1.39 (9) 1.31 (5) 6 1.17 (1) 1.29 (3.5) 7 1.48 (14) 1.52 (18) 8 1.42 (11) 1.37 (7.5) 9 21.29 (3.5) 1.44 (13) 10 1.40 (10) 1.53 (19) Rank Sum W=85.5 Revision: 3-12 47

Example 15.6 (continued) And now determine the rejection region Revision: 3-12 48

Example 15.6 (continued) And, finally, conduct the test What do you conclude? Revision: 3-12 49

Large Sample Mann-Whitney U Test When n 1 > 10 and n 2 > 10, can use normal approximation It turns out that E U n n /2 1 2 So we can use the test statistic Z Var U n n n n 1 /12 1 2 1 2 U E U U n n 1 2/2 Var( U) n n n n 1 /12 1 2 1 2 50

Large Sample U Test (n 1 > 10, n 2 > 10) The null hypothesis is The test statistic is Z H 0 : population dist'ns the same Three possible alternative hypotheses and tests: U n n 1 2 n n n n 1 2 1 2 /2 1 /12 Alternative Hypothesis Ha : Xs to left of Ys Ha : Xs to right of Ys Rejection Region for Level a Test z z z a z a (upper-tailed test) (lower-tailed test) H a : locations differ z z or z z a/ 2 a/ 2 (two-tailed test) Revision: 3-12 51

Other Nonparametric Tests Sign tests exist for one-sample tests as well E.g., H0 : F( y0) p0 vs. Ha : F( y0) p0 Common to test p 0 =0.5; i.e., test the median For symmetric distributions, equivalent to testing the mean Can also test quartiles or any other percentile Also, signed-rank and rank sum tests for one sample Kolmogorov-Smirnov tests for distributions Kruskall-Wallis and Friedman tests for ANOVA Runs test for testing randomness Revision: 3-12 52

What We Covered in this Module Discussed advantages and disadvantages of nonparametric tests Described the general two-sample shift model Nonparametric tests for paired data Sign test Wilcoxon signed-rank test Small and large sample variants Nonparametric tests for two-samples of independent data Wilcoxon rank sum test Mann-Whitney U test Revision: 3-12 53

Homework WM&S chapter 15 Required: 4, 9, 13, 17, 23, 25, 27 Extra credit: None Revision: 3-12 54