Chapter 8. Comparing Two Groups



Similar documents
NONPARAMETRIC STATISTICS 1. depend on assumptions about the underlying distribution of the data (or on the Central Limit Theorem)

Lesson 1: Comparison of Population Means Part c: Comparison of Two- Means

Nonparametric Two-Sample Tests. Nonparametric Tests. Sign Test

Part 3. Comparing Groups. Chapter 7 Comparing Paired Groups 189. Chapter 8 Comparing Two Independent Groups 217

Non-Inferiority Tests for Two Means using Differences

NCSS Statistical Software

Two-Sample T-Tests Assuming Equal Variance (Enter Means)

Two-Sample T-Tests Allowing Unequal Variance (Enter Difference)

The Wilcoxon Rank-Sum Test

Research Methodology: Tools

Permutation & Non-Parametric Tests

Statistics. One-two sided test, Parametric and non-parametric test statistics: one group, two groups, and more than two groups samples

EPS 625 INTERMEDIATE STATISTICS FRIEDMAN TEST

THE FIRST SET OF EXAMPLES USE SUMMARY DATA... EXAMPLE 7.2, PAGE 227 DESCRIBES A PROBLEM AND A HYPOTHESIS TEST IS PERFORMED IN EXAMPLE 7.

SCHOOL OF HEALTH AND HUMAN SCIENCES DON T FORGET TO RECODE YOUR MISSING VALUES

SPSS Tests for Versions 9 to 13

Nonparametric Statistics

1 Nonparametric Statistics

Two Related Samples t Test

Projects Involving Statistics (& SPSS)

Testing for differences I exercises with SPSS

Parametric and non-parametric statistical methods for the life sciences - Session I

Non-Parametric Tests (I)

Skewed Data and Non-parametric Methods

Comparing Means in Two Populations

t Tests in Excel The Excel Statistical Master By Mark Harmon Copyright 2011 Mark Harmon

SPSS Explore procedure

Tutorial 5: Hypothesis Testing

ANALYSIS OF TREND CHAPTER 5

Chapter 7 Section 7.1: Inference for the Mean of a Population

Statistics for Sports Medicine

Basic Statistical and Modeling Procedures Using SAS

Permutation Tests for Comparing Two Populations

LAB 4 INSTRUCTIONS CONFIDENCE INTERVALS AND HYPOTHESIS TESTING

StatCrunch and Nonparametric Statistics

Testing Group Differences using T-tests, ANOVA, and Nonparametric Measures

General Method: Difference of Means. 3. Calculate df: either Welch-Satterthwaite formula or simpler df = min(n 1, n 2 ) 1.

II. DISTRIBUTIONS distribution normal distribution. standard scores

An introduction to IBM SPSS Statistics

Rank-Based Non-Parametric Tests

Chapter 12 Nonparametric Tests. Chapter Table of Contents

Independent t- Test (Comparing Two Means)

How To Test For Significance On A Data Set

ISyE 2028 Basic Statistical Methods - Fall 2015 Bonus Project: Big Data Analytics Final Report: Time spent on social media

One-Way ANOVA using SPSS SPSS ANOVA procedures found in the Compare Means analyses. Specifically, we demonstrate

MEASURES OF LOCATION AND SPREAD

Chapter 8 Paired observations

NCSS Statistical Software

Nonparametric Statistics

THE KRUSKAL WALLLIS TEST

NCSS Statistical Software. One-Sample T-Test

1.5 Oneway Analysis of Variance

SPSS ADVANCED ANALYSIS WENDIANN SETHI SPRING 2011

CHAPTER 14 NONPARAMETRIC TESTS

Overview of Non-Parametric Statistics PRESENTER: ELAINE EISENBEISZ OWNER AND PRINCIPAL, OMEGA STATISTICS

One-Way Analysis of Variance (ANOVA) Example Problem

QUANTITATIVE METHODS BIOLOGY FINAL HONOUR SCHOOL NON-PARAMETRIC TESTS

Chapter 5 Analysis of variance SPSS Analysis of variance

EXCEL Analysis TookPak [Statistical Analysis] 1. First of all, check to make sure that the Analysis ToolPak is installed. Here is how you do it:

Research Methods & Experimental Design

The Chi-Square Test. STAT E-50 Introduction to Statistics

HYPOTHESIS TESTING WITH SPSS:

Comparing Two Groups. Standard Error of ȳ 1 ȳ 2. Setting. Two Independent Samples

SPSS Guide How-to, Tips, Tricks & Statistical Techniques

Difference tests (2): nonparametric

Unit 31 A Hypothesis Test about Correlation and Slope in a Simple Linear Regression

Bowerman, O'Connell, Aitken Schermer, & Adcock, Business Statistics in Practice, Canadian edition

Analysis of categorical data: Course quiz instructions for SPSS

Nonparametric tests these test hypotheses that are not statements about population parameters (e.g.,

Inference for two Population Means

Paired T-Test. Chapter 208. Introduction. Technical Details. Research Questions

Introduction to Quantitative Methods

SAS/STAT. 9.2 User s Guide. Introduction to. Nonparametric Analysis. (Book Excerpt) SAS Documentation

Using Excel for inferential statistics

Erik Parner 14 September Basic Biostatistics - Day 2-21 September,

UNIVERSITY OF NAIROBI

Analysis of Variance ANOVA

ADD-INS: ENHANCING EXCEL

C. The null hypothesis is not rejected when the alternative hypothesis is true. A. population parameters.

UNDERSTANDING THE DEPENDENT-SAMPLES t TEST

7. Comparing Means Using t-tests.

Descriptive Analysis

The Statistics Tutor s Quick Guide to

Non-parametric Tests Using SPSS

Case Study Call Centre Hypothesis Testing

Section 13, Part 1 ANOVA. Analysis Of Variance

12: Analysis of Variance. Introduction

Opgaven Onderzoeksmethoden, Onderdeel Statistiek

IBM SPSS Statistics 20 Part 4: Chi-Square and ANOVA

Once saved, if the file was zipped you will need to unzip it. For the files that I will be posting you need to change the preferences.

INTERPRETING THE ONE-WAY ANALYSIS OF VARIANCE (ANOVA)

Data Analysis, Research Study Design and the IRB

Linear Models in STATA and ANOVA

SPSS Resources. 1. See website (readings) for SPSS tutorial & Stats handout

Introduction. Chapter 14: Nonparametric Tests

Chapter 2 Probability Topics SPSS T tests

Transcription:

Chapter 8 Comparing Two Groups 1

Tests comparing two groups Two independent samples Two-sample t-test(normal populations) Wilcoxon rank-sum test (non-parametric) Two related samples Paired t-test (normal population) Sign Test or Wilcoxon signed rank test (non-parametric) 2

Two independent samples Subjects are randomly assigned to a control or treatment group (where a drug is administered). There response times to a stimulus are then measured. 3

Data Response time in millisecond Control Treatment 80 100 93 103 83 104 89 99 98 102 4

Two-sample t-test: SAS Test H 0 : µ t µ c = 0 against H 0 : µ t µ c 0 / Example 8.1 Two sample test / data ex8 1; infile F:\ST2137\lecdata\ex8 1.txt firstobs=2; input group $ time; proc ttest data=ex8 1; title t-test Example ; class group; var time; run; / proc ttest uses a class statement to identify the two groups of subjects. / 5

Two-sample t-test: SAS output 6

Two-sample t-test: SAS output 7

Two-sample t-test: R >ex8.1=read.table( F:/ST2137/lecdata/ex8 1.txt,header=T) >attach(ex8.1) >cont=time[group== c ] >treat=time[group== t ] >var.test(cont,treat)#test if the variables are equal F test to compare two variances data: cont and treat F=12.3953, num df=4, denom df=4, p-value=0.03177 alternative hypothesis: true ratio of variances is not equal to 1 95 percent confidence interval: 1.290573 119.051498 sample estimates: ratio of variances 12.39535 8

Two-sample t-test: R >t.test(cont,treat,mu=0,var.equal=false) Welch Two Sample T-Test data: cont and treat t=-3.8302 df=4.641, p-value=0.01410 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -21.931655-4.068345 sample estimates: mean of x mean of y 88.6 101.6 9

Two-sample t-test: SPSS Analyze Compare Means Independent Sample T tests... Move time to the Test Variables panel and group to the Grouping Variable panel. Click Define Groups... Input the values for the two groups Continue OK 10

Two-sample t-test: SPSS 11

Two-sample t-test: SPSS 12

Two independent samples: Nonparametric tests Assumptions of two-sample t-test not met The data are not normally distributed and the sample size is small 13

Two independent samples: Nonparametric tests E.g. The following numbers in a psychology experiment that measured the response to a stimulus 0 6 0 5 7 6 9 4 8 0 7 0 5 6 6 0 0 It may be due to a threshold effect. The response is either 0 (the stimulus is not detected), or, once the stimulus is detected, the average response is about 6. 14

Two independent samples: Nonparametric tests The data values may only represent ordered categories. E.g. Scales such as 1=very mild, 2=mild, 3=moderate, 4=strong, 5=severe reflect the strength of a response We cannot say that a score of 4(strong) is worth twice the score of 2 (mild). We need a nonparametric test to analyze differences in central tendencies for ordinal data. For very small samples, nonparametric tests are often more appropriate since assumptions concerning distributions are difficult to determine. 15

Wilcoxon rank sum test (Mann-Whitney U-test) Consider the following experiment Group A: No treatment. Group B: Treated with a drug to prevent tumor formation Both groups are exposed to a chemical that encourages tumor growth The masses (in grams) of tumors in Groups A and B are A: 3.1 2.2 1.7 2.7 2.5 B: 0.0 0.0 1.0 2.3 Mass: 0.0 0.0 1.0 1.7 2.2 2.3 2.5 2.7 3.1 Group:B B B A A B A A A Rank: 1.5 1.5 3 4 5 6 7 8 9 16

Wilcoxon rank sum test (Mann-Whitney U-test) Sum ranks of Group A=4+5+7+8+9=33 Sum ranks of Group B=1.5+1.5+3+6=12 If there were smaller tumors in Group B, we would expect the B s to be at the lower rank ordering and therefore have a smaller sum of ranks then the A s. 17

Wilcoxon rank sum test: SAS data ex8 2; infile F:\ST2137\lecdata\ex8 2.txt firstobs=2; input group $ mass; proc npar1way data=ex8 2 wilcoxon; title Nonparametric Test to Compare Tumor Masses ; class group; var mass; exact wilcoxon; run; 18

Wilcoxon rank sum test: SAS 19

Wilcoxon rank sum test: SAS 20

Wilcoxon rank sum test: R >ex8.2=read.table( F:/ST2137/lecdata/ex8 2.txt,header=T) >attach(ex8.2) >gp.a=mass[group== A ] >gp.b=mass[group== B ] > >wilcox.test(gp.a,gp.b) Wilcoxon rank sum test with continuity correction data: gp.a,gp.b W=18, p=value=0.06506 alternative hypothesis: true mu is not equal to 0 Warning message: cannot compute exact p-value with ties in:wilcox.test.default(gp.a,gp.b) 21

Wilcoxon rank sum test: SPSS We create a numeric variable Groupno to represent the groups Transform Recode into different variable... Move group to String variable panel Complete Output Variable window Change Click Old and New values and input the values Continue OK 22

Wilcoxon rank sum test: SPSS 23

Wilcoxon rank sum test: SPSS 24

Wilcoxon rank sum test: SPSS Analyze Nonparametric Tests Legacy Dialogs 2 Independent samples... Move mass to the Test Variable List and Groupno to the Grouping Variable Click Define Groups... Input the values for the two groups Choose Mann-Whitney U in the Test-Type 25

Wilcoxon rank sum test: SPSS 26

Wilcoxon rank sum test: SPSS 27

Paired t-test (Related Samples) There are many situations where each subject receives both treatments Each subject could have been measured in the absence of drug and after receiving the drug The response time for the control and treatment groups would no longer be independent. 2-sample t-test cannot be used since the groups are no longer independent. A paired t-test can be used if the differences between before and after treatments follow a normal distribution. 28

Paired t-test: SAS data ex8 3; infile F:\ST2137\lecdata\ex8 3.txt firstobs=2; input subject ctime ttime; proc ttest data=ex8 3; title A Paired t-test ; paired ctime*ttime; run; 29

Paired t-test: SAS output 30

Paired t-test: R >ex8.3=read.table( F:/ST2137/lecdata/ex8 3.txt,header=T) >attach(ex8.3) >t.test(control,treatment,mu=0,paired=true) Paired t-test data:control and treatment t=-4.3481,df=5,p-value=0.007372 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -11.66874-2.997923 sample estimates: mean of the differences -7.333333 31

Paired t-test: SPSS Analyze Compare Means Paired Sample T test... Highlight the two variables control and treatment simultaneously Move these 2 variables to Paired Variables panel OK 32

Paired t-test: SPSS output 33

2 Related Samples: Nonparametric tests We apply the one sample nonparametric tests to the difference of the paired observations. One sample nonparametric tests: Sign test Wilcoxon Signed rank test Example 8.4 Consider an experiment that each subject tries each of the two drugs The time span to pain relief is measured Subject 1 2 3 4 5 6 7 8 drug A 20 40 30 45 19 27 32 26 drug B 18 36 32 46 15 22 29 25 34

Sign test Consider example 8.4 The differences in time span between Drug A and Drug B are Subject 1 2 3 4 5 6 7 8 Difference 2 4-2 -1 4 5 3 1 Sign + + - - + + + + Number of positive signs=6 and number of negative signs=2 If there was no difference in the two drugs, we expect the number of positive signs(i.e. A<B) should be more or less the same as the number of negative signs( i.e. B<A) 35

Wilcoxon signed rank test The differences in time span between Drug A and Drug B are Subject 1 2 3 4 5 6 7 8 Difference 2 4-2 -1 4 5 3 1 Rank of absolute 3.5 6.5 3.5 1.5 6.5 8 5 1.5 Sign + + - - + + + + Sum of positive ranks: 3.5+6.5+3.5+8+5+1.5=31 Sum of negative ranks: 3.5+1.5=5 If there was no difference in the two drugs, we would expect the sum of the ranks of positive signs should be more or less the same as the ranks of negative signs. 36

2 Related Samples Nonparametric tests: SAS data ex8 4; infile F:\ST2137\lecdata\ex8 4.txt firstobs=2; input subject drug A drug B; diff=drug A-drug B; proc univariate data=ex8 4; title Nonparametric Test for 2 related samples ; var diff; run; 37

2 Related Samples Nonparametric tests: SAS output 38

2 Related Samples Nonparametric tests: SAS output 39

2 Related Samples Nonparametric tests: R >ex8.4=read.table( F:/ST2137/lecdata/ex8 4.txt,header=T) >attach(ex8.4) >diff=drug A-drug B >ncount=sum(sign(diff[diff>0]))#get the number of positive signs >binom.test(ncount,length(diff),0.5)#binom.test(obs x,n,h 0:p=0.5) Exact binomial test data: ncount and length(diff) number of successes = 6, number of trials = 8, p-value = 0.2891 alternative hypothesis: true probability of success is not equal to 0.5 95 percent confidence interval: 0.3491442 0.9681460 sample estimates: probability of success 0.75 40

2 Related Samples Nonparametric tests: R >wilcox.test(diff) Wilcoxon signed rank test with continuity correction data: diff V = 31, p-value = 0.07895 alternative hypothesis: true location is not equal to 0 Warning message: In wilcox.test.default(diff) : cannot compute exact p-value with ties 41

2 Related Samples Nonparametric tests: SPSS Analyze Nonparametric Tests Legacy Dialogs 2 Related Samples... Highlight the two variables drug A and drug B simultaneously Move these 2 variables to Test Pair(s) List panel OK Check Wilcoxon and Sign OK 42

2 Related Samples Nonparametric tests: SAS output 43

2 Related Samples Nonparametric tests: SPSS output 44

2 Related Samples Nonparametric tests: SPSS output 45