Testing for a difference

Slides:



Advertisements
Similar presentations
Prepared by Lloyd R. Jaisingh
Advertisements

Mann-Whitney U-test Testing for a difference U 1 = n 1 n 2 + ½ n 1 (n 1 + 1) – R 1.
T-test - unpaired Testing for a difference. What does it do? Tests for a difference in means Compares two cases (eg areas of lichen found in two locations)
1 COMM 301: Empirical Research in Communication Lecture 15 – Hypothesis Testing Kwan M Lee.
2013/12/10.  The Kendall’s tau correlation is another non- parametric correlation coefficient  Let x 1, …, x n be a sample for random variable x and.
Irwin/McGraw-Hill © Andrew F. Siegel, 1997 and l Chapter 16 l Nonparametrics: Testing with Ordinal Data or Nonnormal Distributions.
Mann-Whitney and Wilcoxon Tests.
Statistical Analysis. Purpose of Statistical Analysis Determines whether the results found in an experiment are meaningful. Answers the question: –Does.
(a brief over view) Inferential Statistics.
Chi-squared Testing for a difference. What does it do? Compares numbers of people/plants/species… in different categories (eg different pollution levels,
Chi-squared Goodness of fit. What does it do? Tests whether data you’ve collected are in line with national or regional statistics.  Are there similar.
NONPARAMETRIC STATISTICS
Statistical Analysis A Quick Overview. The Scientific Method Establishing a hypothesis (idea) Collecting evidence (often in the form of numerical data)
Choosing Your Test Spearman’s? Chi-squared? Mann-Whitney?
Correlation – Pearson’s. What does it do? Measures straight-line correlation – how close plotted points are to a straight line Takes values between –1.
Copyright © Cengage Learning. All rights reserved. 14 Elements of Nonparametric Statistics.
Chi-Square X 2. Parking lot exercise Graph the distribution of car values for each parking lot Fill in the frequency and percentage tables.
PCB 3043L - General Ecology Data Analysis. OUTLINE Organizing an ecological study Basic sampling terminology Statistical analysis of data –Why use statistics?
Nonparametric Statistics. In previous testing, we assumed that our samples were drawn from normally distributed populations. This chapter introduces some.
Nonparametric Statistics
T-test - paired Testing for a difference. What does it do? Tests for a difference in means Compares two cases (eg soil moisture content north & south.
Chap 8-1 Fundamentals of Hypothesis Testing: One-Sample Tests.
Ex St 801 Statistical Methods Inference about a Single Population Mean.
PCB 3043L - General Ecology Data Analysis.
Statistics Statistics Data measurement, probability and statistical tests.
Understanding Statistics © Curriculum Press 2003     H0H0 H1H1.
Wilcoxon Signed Rank Testing for a difference R+ RR
Chi-squared Association Index. What does it do? Looks for “links” between two factors  Do dandelions and plantains tend to grow together?  Does the.
Correlation – Spearman’s. What does it do? Measures rank correlation – whether highest value in the 1 st data set corresponds to highest in the 2 nd set.
Testing for a difference
Inferential Statistics 3: The Chi Square Test
Geog4B The Chi Square Test.
Data measurement, probability and Spearman’s Rho
Chapter 12 Chi-Square Tests and Nonparametric Tests
DTC Quantitative Methods Bivariate Analysis: t-tests and Analysis of Variance (ANOVA) Thursday 20th February 2014  
Learning Objectives: 1. Understand the use of significance levels. 2
NONPARAMETRIC STATISTICS
Testing for a difference
Data analysis Research methods.
Statistics in psychology
PCB 3043L - General Ecology Data Analysis.
University of Warwick, Department of Sociology, 2014/15 SO 201: SSAASS (Surveys and Statistics) (Richard Lampard) Analysing Means II: Nonparametric techniques.
Hypothesis Testing Using the Chi Square (χ2) Distribution
Chapter 14 in 1e Ch. 12 in 2/3 Can. Ed.
Hypothesis Testing: Hypotheses
Learning Aims By the end of this session you are going to totally ‘get’ levels of significance and why we do statistical tests!
Data measurement, probability and statistical tests
Spearman’s rho Chi-square (χ2)
Inferential Statistics
Inferential Statistics
Inferential statistics,
Inferential Statistics
INTRODUCTORY STATISTICS FOR CRIMINAL JUSTICE Test Review: Ch. 7-9
Parametric and non parametric tests
Hypothesis Theory examples.
Hypothesis tests for the difference between two means: Independent samples Section 11.1.
AP Stats Check In Where we’ve been… Chapter 7…Chapter 8…
Using Statistical techniques in Geography
1.3 Data Recording, Analysis and Presentation
Non-parametric tests, part A:
One-Way Analysis of Variance
Chi-squared Association Index
The Rank-Sum Test Section 15.2.
Data measurement, probability and statistical tests
Doing t-tests by hand.
Nonparametric Statistics
Research Methods: Data analysis and reporting investigations.
Skills 5. Skills 5 Standard deviation What is it used for? This statistical test is used for measuring the degree of dispersion. It is another way.
Section 11.1: Significance Tests: Basics
Inferential testing.
Presentation transcript:

Testing for a difference U1 = n1 n2 + ½ n1 (n1 + 1) – R1 Mann-Whitney U-test Testing for a difference Note: the equivalent of this for paired data is Wilcoxon

What is it? A technique to see if there is a difference between the medians of two sets of data. It is non-parametric (assumes the data is not normally distributed). However, it does assume that there is similar dispersion of both sets of data (you can check this on a dispersion graph).

Mann-Whitney U test can be used... You can only compare two sets of data The data must be ordinal (ranked in order) You need a minimum of 5 values in each data set It is not advisable to use more than 20 values in each data set The Mann-Whitney U test starts with a null hypothesis.

What does it do? Tests for a difference in averages (medians – the middle value – to be exact) Compares two cases (eg species diversity in polluted and unpolluted water) The data can be of any kind, provided it’s numerical eg lengths, percentages, numbers of people… The samples do not have to be of the same size You can use this test for any data, provided you have at least 5 values in each sample. If the data are numbers of people/items etc, then chi-squared could also be used

Planning to use it? Make sure that… You want to test for difference You have just two cases to compare You have five or more values from each case If your data are likely to be normally distributed, it may be easier to get a significant result using the t-test It’s still OK to use MW instead of t, if the student would rather

How does it work? You assume (null hypothesis) there is no difference between the two cases The test involves ranking all the data together, then adding up the ranks for each sample. If, for example, the values in the first sample were all much bigger, then the first sample would have higher ranks

Strength and Weaknesses Strengths Weaknesses You can use two data sets that have different sizes e.g. One data set could have 10 values and the other only 8 You can state whether the relationship is significant or if your results occurred by chance You can see clearly whether there is a difference in the median of two sets of data It is a lengthy calculation and prone to human error It does not explain why the difference in the two data sets occurs

Doing the test These are the stages in doing the test: Write down your hypotheses Doing the ranking Calculating your U-values Look at the tables Make a decision The underlined terms are hyperlinks to the appropriate slide Click here for an example

Hypotheses H0: There is no difference between population 1 and population 2 For H1, you have a choice, depending on what alternative you were looking for. H1: Population 1 is larger than population 2 eg: Species diversity in unpolluted water is greater than in polluted water or H1: Population 1 is different to population 2 eg: Species diversity is different in unpolluted water and polluted water Unless you have a good geographical reason for expecting one to be larger, you should choose “different” for H1 The form of the alternative hypothesis should be chosen before getting the data – to ensure there really is a good reason for 1-tailed version, if chosen

Ranking We need to put all the data together, and rank it, but remember which sample it’s from. One easy way to do this is to write data from different samples in different colours Give rank 1 to the highest value, rank 2 to the second highest and so on. If there are any ties, give them the average of the ranks they would have had. eg Suppose three pieces of data tie for second place. They would otherwise have been in 2nd, 3rd and 4th place. So give them all the average of 2nd, 3rd and 4th – that’s rank 3. It is important to do the ranking this way round – otherwise the one-tailed hypothesis test won’t work Ties are done as in Spearman’s

U-values First work out: Then work out R1 = sum of ranks for sample 1 U1 = n1 n2 + ½ n1 (n1 + 1) – R1 U2 = n1 n2 + ½ n2 (n2 + 1) – R2 n1 , n2 are the sizes of the two samples

Sizes of the two samples. Tables This is a Mann-Whitney table You usually have to look in a different table for different significance levels Sizes of the two samples. The bigger one is “n2” Some MW tables have 2 or 3 significance levels on different rows on the table.

Make a decision If you used: H1: Population 1 is larger than population 2: You are doing a 1-tailed test (1 alternative only considered) Choose the U-value from the sample you’d expected to be larger (It should be the smaller U-value) If your U-value is smaller than the tables value, you reject your null hypothesis If you used H1: Population 1 is different to population 2: You are doing a 2-tailed test (both alternatives considered) Choose the smaller of the two U-values Worth emphasising that this one is unusual – in most cases, reject H0 if our value is larger than tables

Example: Invertebrates in Long & Short Grass Data were obtained for the number of invertebrates caught in sweep nets at 8 sites in long and short grass. Hypotheses: H0: There is no difference in the number of invertebrates in long and short grass H1 There is a difference in the number of invertebrates in long and short grass Could actually use chi-squared here

The data Site 1 2 3 4 5 6 7 long grass 41 43 34 37 15 22 27 short grass 47 38 98 27 72 65

Ranking We need to put all the data together, and rank it, but remember whether it’s a long or short grass We’ll do this with colours long short We have: 41, 43,34, 37,15, 22, 27, 47, 38, 98, 27, 72, 65 In order: 98, 72, 65, 47, 43, 41, 38, 37, 34, 27, 27, 22, 15 Ranks: 1 2 3 4 5 6 7 8 9 10.5 10.5 12 13 Note tied ranks for the two “27”s.

U-Values First find the sum of ranks for long and short grass: Now work out the two U values, using the formulae: U1 = n1 n2 + ½ n1 (n1 + 1) – R1 U2 = n1 n2 + ½ n2 (n2 + 1) – R2 So U1 = (7)(6) + ½ 7 (7 + 1) – 63.5 = 6.5 (long grass) U2 = (7)(6) + ½ 6 (6 + 1) – 27.5 = 35.5 (short grass) Doesn’t matter which you call “sample 1” and which you call “sample 2”, provided you are consistent

Sizes of the two samples. Tables This is a Mann-Whitney table You usually have to look in a different table for different significance levels Sizes of the two samples. The bigger one is “n2” Some MW tables have 2 or 3 significance levels on different rows on the table.

The Test Since our H1 referred to “a difference”, we’re doing the 2-tailed test U = smaller of U1 and U2 = 6.5 Critical value (5%) = 6 Our value is larger. So accept H0 – there is no significant difference between the numbers of invertebrates in long grass and in short grass. If we’d done a 1-tailed test, we could have rejected H0.

Inner city (St Peter & the Waterfront) Outer Suburb (Plymstock) One for you to try... In this example a student is investigating economic deprivation across the city of Plymouth. Student’s hypothesis: There is a greater income deprivation score for inner-city areas than outer suburbs. The income deprivation score measures the percentage of people who are income-deprived. The higher the score, the more income-deprived the area is. Inner city (St Peter & the Waterfront) Outer Suburb (Plymstock) 0.53 0.05 0.40 0.09 0.24 0.06 0.25 0.12 0.08 0.16 0.10 0.20 0.13

Sizes of the two samples. Tables This is a Mann-Whitney table You usually have to look in a different table for different significance levels Sizes of the two samples. The bigger one is “n2” Some MW tables have 2 or 3 significance levels on different rows on the table.

Doing the test These are the stages in doing the test: Write down your hypotheses Doing the ranking Calculating your U-values Look at the tables Make a decision The underlined terms are hyperlinks to the appropriate slide Click here for an example

Inner city (St Peter & the Waterfront) U1 Outer Suburb (Plymstock) Rank the data Inner city (St Peter & the Waterfront) U1 Outer Suburb (Plymstock) U2 0.53 0.05 0.40 0.09 0.24 0.06 0.25 0.12 0.08 0.16 0.10 0.20 0.13 Give a different colour for each sample and then rank them in order from the largest value to the smallest value. 0.53, 0.40, 0.25, 0.24, 0.20, 0.16, 0.13, 0.12, 0.12, , 0.10, 0.09, 0.08, 0.08, 0.06, 0.05, 0.05 1 2 3 4 5 6 7 8.5 8.5 10 11 12.5 12.5 14 15.5 15.5

U-Values First find the sum of ranks for long and short grass: Inner City: 1+2+3+4+5+6+8.5+12.5=42 Outer suburbs: 7+8.5+10+11+12.5+14+15.5+15.5=94 Now work out the two U values, using the formulae: U1 = n1 n2 + ½ n1 (n1 + 1) – R1 U2 = n1 n2 + ½ n2 (n2 + 1) – R2 So U1 = (8)(8) + ½ 8 (8 + 1) – 42 = 58 (Inner city) U2 = (8)(8) + ½ 8 (8 + 1) – 94 = 6 (Suburbs) Doesn’t matter which you call “sample 1” and which you call “sample 2”, provided you are consistent

Sizes of the two samples. Tables This is a Mann-Whitney table You usually have to look in a different table for different significance levels Sizes of the two samples. The bigger one is “n2” Some MW tables have 2 or 3 significance levels on different rows on the table.

The Test Since our H1 referred to “a difference”, we’re doing the 2-tailed test U = smaller of U1 and U2 = 6 Critical value (5%) = 13 Our value is smaller. So we accept the Hypothesis – There is a greater income deprivation score for inner-city areas than outer suburbs. If we’d done a 1-tailed test, we could have rejected H0.

Sediment size foe Darcy Beach (x) Sediment size for Mapleton (y) Mann-Whitney Put the two data sets in order Sediment size foe Darcy Beach (x) Sediment size for Mapleton (y) 32 45 42 26 12 19 40 21 33 16 4 9 3 N= 9 N = 9 .

Answers Here are our 2 data sets. Darcy Beach in black and Mapleton in blue 32,42, 26,19,21,16,12,4,3, 45,32,12,40,33,26,16,9,4 Then we order them and rank them. 45 42 40 33 32 26 21 19 16 12 9 4 3 1 2 5.5 7.5 10 11.5 13.5 15 16.5 18

The sum of the ranks for Darcy Beach is:- 93.5 The sum of the ranks for Mapleton is :- 77.5 Using the formula’s we have to work out the U value U1 = (9)(9) + ½ 9 (9 + 1) – 93.5 = 32.5 U2 = (9)(9) + ½ 9 (9 + 1) – 77.5 = 48.5 You can check your formula calculations by making sure your 2 U values when added equal the same as your two N numbers multiplied together

The smallest U number is for Darcy Beach at the value of 32.5. Our critical value (5%) = 17 Our value is larger. We accept our null hypothesis.