44
Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Embed Size (px)

Citation preview

Page 1: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Stats 2022n

Non-Parametric Approaches to DataChp 15.5 & Appendix E

Page 2: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

OutlineChp 15.5 alternative to

Spearman Correlation Example Pearson correlation

Appendix E

Mann - Whitney U-Test Example independent measures t test

Wilcoxon signed-rank test Example repeated-measures t test

Kruskal – Wallace Test independent measures ANOVA)

Friedman Test (repeated measures ANOVA)

Page 3: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

A note on ordinal scales

• An ordinal scale :

Example – Grades

Page 4: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

A note on ordinal scales

Ordinal scales allow ranking

Example – Grades

Page 5: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Why use ordinal scales?

• Some data is easier collected as ordinal

Page 6: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

The case for ranking data

1. Ordinal data needs to be ranked before it can be tested (via non-parametric tests)

2. Transforming data through ranking can be a useful tool

Page 7: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Ranking data (rank transform) can be a useful tool

– If assumptions of a test are not (or cannot be) met…

– Common if data has:• Non linear relationship …• Unequal variance…• High variance …

– Data sometimes requires rank transformation for analysis

The case for ranking data

Page 8: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Rank Transformation

Group A Group B8 54

98 8258 9278 23

A Ranks B Ranks1 38 64 75 2

Page 9: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Rank Transformation

Group A Group B8 68 68 27 1

What if ties?....

Page 10: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Ordinal TransformationRanking Data, If Ties

Groupscores

(ordered) rankrank

(tie adjusted)B 1 1 1B 2 2 2B 6 3 3.5B 6 4 3.5A 7 5 5A 8 6 7A 8 7 7A 8 8 7

Group A Group B8 68 68 27 1

A Ranks B Ranks1 52 73.5 73.5 7

Page 11: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Chp 15.5Spearman Correlation

Page 12: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Spearman Correlation

Only requirement – ability to rank order data• Data already ranked• Rank transformed data

Rank transform useful if relationship non-linear…

Page 13: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Spearman Correlation

Participant x yA 4 9B 2 6C 2 2D 10 10E 3 8F 7 10

0 2 4 6 8 10 120

2

4

6

8

10

12

Participant x y x rank y rankA 4 9 4 4B 2 6 1.5 2C 2 2 1.5 1D 10 10 6 5.5E 3 8 3 3F 7 10 5 5.5

1 2 3 4 5 6 70

1

2

3

4

5

6

Example

Page 14: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Spearman Correlation

x rank y rank xy x2 y2

4 4 16 16 161.5 2 3 2.25 41.5 1 1.5 2.25 16 5.5 33 36 30.253 3 9 9 95 5.5 27.5 25 30.25

21 21 90 90.5 90.5

x 21 y 21 x2 90.5 y2 90.5 xy 90

Calculation

Page 15: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Spearman Correlation

x 21 y 21 x2 90.5 y2 90.5 xy 90

Calculation

Page 16: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Spearman Correlation

x rank y rank D D2

4 4 0 01.5 2 0.5 0.251.5 1 -0.5 0.256 5.5 -0.5 0.253 3 0 05 5.5 0.5 0.25

0 1

= = =

Spearman Correlation Special Formula

Page 17: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Spearman Correlation

x rank y rank D D2

4 4 0 01.5 2 0.5 0.251.5 1 -0.5 0.256 5.5 -0.5 0.253 3 0 05 5.5 0.5 0.25

0 1

𝑟 𝑠=1−6∑D2

n (n2−1 )=0.9714

Spearman Correlation Special Formula

v.s.

Page 18: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Hypothesis testing with spearman

• Same process as Pearson – (still using table B.7)

Page 19: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Appendix E

Mann - Whitney U-TestWilcoxon signed-rank test

Kruskal – Wallace Test Friedman Test

Page 20: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Mann - Whitney U-Test

– Requirements• •

– Hypotheses: • •

Page 21: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Mann - Whitney U-Test

Illustration

Sample A Ranks

Sample B Ranks

1 6

2 7

3 8

4 9

5 10

Sample A Ranks

Sample B Ranks

1 2

3 4

5 6

7 8

9 10

Extreme difference due to conditionsDistributions of ranks unequal

No difference due to conditionsDistributions of ranks unequal

Page 22: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Mann - Whitney U-TestExample

Group ScoreA 8A 98A 58A 78A 42A 14A 63A 84B 54B 82B 92B 23B 53B 41B 28B 25

Group A Group B8 54

98 8258 9278 2342 5314 4163 2884 25

ranked (sorted) according to valuesGroup Score Rank

A 8 1A 14 2B 23 3B 25 4B 28 5B 41 6A 42 7B 53 8B 54 9A 58 10A 63 11A 78 12B 82 13A 84 14B 92 15A 98 16

Page 23: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Mann - Whitney U-Test

Group RankA 1A 2B 3B 4B 5B 6A 7B 8B 9A 10A 11A 12B 13A 14B 15A 16

A Ranks B Ranks1 32 47 5

10 611 812 914 1316 15

A Ranks B Ranks1 0 3 22 0 4 27 4 5 2

10 6 6 211 6 8 312 6 9 314 7 13 616 8 15 7UA 37 UB 27

verify: 8*8= 64 37+27=64

U=27

Computing U by hand

Page 24: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Mann - Whitney U-TestComputing U via formula

A Ranks B Ranks1 32 47 5

10 611 812 914 1316 15

R 73 63

RA = 73 RB = 63

= 8 U=27

Page 25: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Mann - Whitney U-TestEvaluating Significance with U

U=27

alpha = 0.05, 2 tails, df(8,8)

Critical value = 13

U > critical value, we fail to reject the null

The ranks are equally distributed between samples

H0:

H1:

Page 26: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Mann - Whitney U-TestWrite-Up

The original scores were ranked ordered and a Mann-Whitney U-test was used to compare the ranks for the n = 8 participants in treatment A and the n = 8 participants in treatment B. The results indicate no significant difference between treatments, U = 27, p >.05, with the sum of the ranks equal to 27 for treatment A and 37 for treatment B.

Page 27: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Mann - Whitney U-TestEvaluating Significance Using Normal Approximation

¿(8 ) (8 )2

=32

¿√ (8 ) (8 ) (8+8+1 )12

=√90.66666667=9.52190

With n>20, the MW-U distribution tends to approximate a normal shape, and so, can be evaluated using a z-score statistic as an alternative to the MW-U table.

U=27 = 8 Note: n not > 20!

Page 28: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Mann - Whitney U-TestEvaluating Significance Using Normal Approximation

¿32

¿9.52190

¿(27 )− (32 )9.52190

=−0.5251

alpha = 0.052 tailsCritical value: z = ± 1.96

-0.5251 is not in the critical regionFail to reject the null.

Page 29: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Wilcoxon signed-rank test

Hypotheses:• H 0:

• H 1:

participant Condition 1 Ciondition 2 differenceA 1 3 -2B 6 2 4C 9 10 -1D 7 10 -3E 9 4 5F 3 9 -6G 2 2 0H 9 1 8I 9 1 8J 3 5 -2K 1 4 -3

Requirements• Two related samples (repeated measure)• Rank ordered data

Page 30: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Wilcoxon signed-rank test

Participant DifferenceA -2B 4C -1D -3E 5F -6H 8I 8J -2K -3

Sorted and ranked by magnitudeParticipant Difference Rank

C -1 1A -2 2.5J -2 2.5D -3 4B 4 5E 5 6F -6 7H 8 8.5I 8 8.5

Page 31: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Wilcoxon signed-rank test

Sorted and ranked by magnitudeParticipant Difference Rank

C -1 1A -2 2.5J -2 2.5D -3 4B 4 5E 5 6F -6 7H 8 8.5I 8 8.5

Positiverank scores

Negativerank scores

5 16 2.5

8.5 2.58.5 4

7 R 28 17

T= 17

Page 32: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Wilcoxon signed-rank test

T= 17n=10alpha = .05two talescritical value = 8

T obtained > critical value, fail to reject the null

The difference scores are not systematically positive or systematically negative.

Page 33: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Wilcoxon signed-rank test

The 11 participants were rank ordered by the magnitude of their difference scores and a Wilcoxon T was used to evaluate the significance of the difference between treatments. One sample was removed due to having a zero difference score. The results indicate no significant difference, n = 10, T = 17, p <.05, with the positive ranks totaling 28 and the negative ranks totaling 17.

Write up

Page 34: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Wilcoxon signed-rank test

Participant Difference RankC 0 1.5A 0 1.5J -2 3D -3 4B 4 5

Positiverank scores

Negativerank scores

1.5 1.54 3

R 5.5 4.5

A note on difference scores of zero

Participant Difference RankC 0 1A 0 1.5J 0 1.5D -3 3B 4 4

Participant Difference RankC 0A 2 1.5J -2 1.5D -3 3B 4 4

N = 4

N = 5

N = 4

Positiverank scores

Negativerank scores

1.5 1.55 3

4 R 6.5 8.5

Positiverank scores

Negativerank scores

1.5 1.54 3

R 5.5 4.5

Page 35: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Wilcoxon signed-rank testEvaluating Significance Using Normal ApproximationT= 17 n= 10 Note: n not > 20!

Page 36: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Wilcoxon signed-rank testEvaluating Significance Using Normal Approximation

T = 17

alpha = 0.052 tailsCritical value: z = ± 1.96

-0.21847 is not in the critical regionFail to reject the null.

Page 37: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Interim Summary

Calculation of Mann-Whitney or Wilcoxon is fair game on test.

When to use Mann-Whitney or Wilcoxon

• If data is already ordinal or ranked

• If assumptions of parametric test are not met

Page 38: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Kruskal – Wallace Test

• Alternative to independent measures ANOVA

• Expands Mann – Whitney

• Requirements

• Null –

Page 39: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Kruskal – Wallace Test

• Rank ordered data (all conditions)

Page 40: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Kruskal – Wallace Test

For each treatment condition• n: n for each group• T: sum of ranks for each groupOverall• N: Total participants

Statistic identified with H

Distribution approximates same distribution as chi-squared (i.e. use the chi squared table)

Page 41: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Friedman Test

• Alternative to repeated measures ANOVA

• Expands Wilcoxon test

• Requirements

• Null

Page 42: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Friedman Test

• Rank ordered data (within each participant)

Page 43: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Friedman Test

• For each treatment condition– n: n for each group– r: sum of ranks for each condition

• Overall– k: Total groups

• Uses distribution for hypothesis testing. Chi square statistic for ranks.

Page 44: Stats 2022n Non-Parametric Approaches to Data Chp 15.5 & Appendix E

Summary

Groups 2 3+

Independent measure

Repeated measure

Groups 2 3+

Independent measure

Repeated measure

Ratio Data Ranked Data