Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
NSG 724 – Health Research Statistics I Lecture 7
Kesheng Wang
Associate Professor
Department of Family and Community HealthSchool of Nursing, West Virginia University
1
Outline• Chapter 7
• Topic 7: Comparing Means of Three Or More Unrelated Groups
• - One-Way ANOVA•- F test
•- Multiple Comparison
•- Check Normality
•- Check Homogeneity of Variance
• - Kruskal-Wallis H Test (KW test)• - Run ANOVA and KW Test• - Homework 2• - No Quiz• - Quiz 3 will be taken in class on October 12. 2
The One-Way ANOVA and the Kruskal-Wallis H-Test: Comparing Means of Three or more Unrelated Groups (Chapter 7)
Objectives
Determine when one-way ANOVA and Kruskal-Wallis H-test are appropriate.
1. Choose between one-way ANOVA and the Kruskal-Wallis H-test
2. Describe between-group, within-group, and total variance
3. Explain what is meant by the use of post hoc tests and a priori comparison
3
t-test for Independent Samples
• Independent t-test: • Used to compare two sample means when
the two samples are independent of one another
• The t-test is the most commonly used method to evaluate the diferences in means between two groups
4
Review
What is ANOVA?
• Analysis of variance (ANOVA) is a collection of statistical models used to analyze the diferences between group means and their associated procedures (such as "variation" among and between groups)
• Comparing the means of more than two groups• The ANOVA test is similar to the t test (compares two
groups); • however, the ANOVA test can compare three or more
groups to each other
5
What is One-Way ANOVA?
• ANOVA = Analysis of Variance• - Understanding how the means of three or more
groups vary- Developed by Sir Ronald Fisher in late 1800’s to further agricultural work (F test)- Important because if you only did multiple t tests between two groups at a time, you would increase risk of type I error
• Kruskal-Wallis H-test = nonparametric analysis comparing the distribution of three or more groups
6
• ANOVA was developed in the 1920’s by Ronald A. Fisher
• The ANOVA F-test is named for Fisher
ANOVA
7
8
Research Questons Involve in ANOVA
• ANOVA for comparison of more than two groups• Research questons involve ANOVAWhich is the best drug for lowering hypertension:
Drug A, Drug B, or Drug C? Is there a statistically signifcant diference in
infection rates among more than three regions? Is there a statistically signifcant diference in
blood pressure among three groups?
What is the Research Queston for ANOVA?
• Are the means of three or more independent groups signifcantly diferent from one another?
• Reports the mean and standard deviation of each group
• One-way – only one grouping variable• Example
– Comparing rates of infectious diseases among 3 regularly scheduled 2-week periods of school closure in during the peak incidence of infectious disease.
– Comparing birthweight among diferent ethnic groups
9
What is the Research Queston for the Kruskal-Wallis H test
• Are the distributions of three or more independent groups signifcantly diferent from one another?
• Reports the median• Not as sensitive as the ANOVA• Example
– Comparing length of stay among three diferent hospitals if the data is not normally distributed
– Comparing birthweight among diferent ethnic groups if the data is not normally distributed
10
Hypothesis of One-Way ANOVA
• E.g., the nurse manager is interested in identifying the most efective drug for managing patients with hypertension (Drug A, Drug B, or Drug C).
• HypothesisH0: There is no statistically diference in the
performance among three drugs.Ha/H1: At least one drug is diferent from others.
11
Assumptons of the ANOVA
• Same as those for the t test• Variable of interest should be a continuous
variable that is normally distributed• Groups should be three or more that are
mutually exclusive• Groups should have equal variances
(homogeneity of variance requirement)• Groups are referred to as “k”
12
Assumptons for One-Way ANOVA
• Independence: Observations within each sample must be independent (they don’t infuence each other). Data are randomly sampled
• Normal Distribution: The dependent variable/scores in each sample must be normally distributed
• Homogeneity of Variance: The variances of each sample/group are assumed equal (the degree to which the distributions are spread out is approximately equal)
• Outcome is interval/ratio variable
13
Assumptons of the Kruskal-Wallis H-test– There are three or more mutually exclusive,
independent groups to compare on some characteristic
– Characteristic can be ordinal, interval, or ratio – doesn’t have to be continuous or normally distributed.
– Nonparametric test (no assumption about distribution)
– No assumptions about variance– Reports the median and interquartile range of
each group
14
An Example in ANOVA Situaton• Subjects: 25 patients with blistersTreatments: Treatment A, Treatment B, PlaceboMeasurement: # of days until blisters heal.
• Data [means]• A: 5,6,6,7,7,8,9,10 [7.25]• B: 7,7,8,9,9,10,10,11 [8.875]• P: 7,9,9,10,10,10,11,12,13 [10.11]
• Do they have differences?• Are these differences significant?
15
Example 1
16
Why not Do Repeated t-Tests?
• You might be tempted to use a series of t tests, comparing two groups each time.
• Repeated t-test increase the chances of type I error or multple comparison problem.
• If you are making comparison between 5 groups, you will need 10 comparisons of 5 means.
• With 10 means for 10 groups, there are 45 comparisons (10 * 9/2 combinatons).
• When level of signifcance is .05, there is a 1 in 20 chance that one t-test will yield a signifcant result (reject the null) even when the null hypothesis is true.
• In an experiment, we usually need keep type I error =0.05.
• The probability of making a Type I error increases as the number of tests increase.• If the probability of a Type I error for the analysis is
set at 0.05 and 10 t-tests are done, the overall probability of a Type I error for the set of tests = 1 –(0.95)10= 0.40 instead of 0.05.
• 0.40 (40%) is the overall probability of making a type I error rate for 10 tests.
17
Why not Do Repeated t-Tests?
One-Way ANOVA• The response variable is the variable you’re
comparing. It requires a continuous variable• The factor variable is the categorical variable being
used to defne the groupsWe will assume k samples (groups)
• The one-way is because each value is classifed in exactly one way (one factor/one independent variable).Examples include comparisons by gender,
income level, drug, political party, etc.
18
Using Variance to Understand Mean Comparisons
ANOVA testing uses a ratio of two types of variance to test hypotheses about differences.
a. Within-Group variance (“error” or “residual” variance) - spread of data within each group - should be equal for the groups (Errors are equal for each group)
b. Between-Group variance - difference between different groups
19
Computng Variance
• First compute the two variances – within group and between group
• Then use these to compute an F-statistic• F-statistic is a ratio of the between-group
variance to the within-group variance• The ratio of two variances follows an F
distribution• Large F is likely greater than the critical value
and likely significant (Appendix F)
20
One-Way ANOVA
• A random sample of depressive patients were treated with 3 drugs (Drug A, Drug B and Drug C).
• One kind of depression score for those patients was recorded– Drug A (n=7): 82, 83, 97, 93, 55, 67, 53– Drug B (n=9): 83, 78, 68, 61, 77, 54, 69, 51, 63– Drug C (n=8): 38, 59, 55, 66, 45, 52, 52, 61
21
Example 2
One-Way ANOVA
The summary statistics for scores of 3 drugs are shown in the table below
Drug A B C
Sample size 7 9 8
Mean 75.71 67.11 53.50
St. Dev 17.63 10.95 8.96
Variance 310.90 119.86 80.29
22
Example 2
One-Way ANOVA
• Variation– Variation is the sum of the squares (SS) of the
deviations between a value and the mean of the value
– Sum of Squares is abbreviated by SS and ofen followed by a variable in parentheses such as SS(B) or SSB (between groups) or SS(W) or SSW (within groups) so we know which sum of squares we’re talking about
23
One-Way ANOVA
– Drug A 82, 83, 97, 93, 55, 67, 53– Drug B: 83, 78, 68, 61, 77, 54, 69, 51, 63– Drug C: 38, 59, 55, 66, 45, 52, 52, 61
• Are all of the values identical?– No, so there is some variation in the data– This is called the total variation– Denoted SS(Total) or SST for the total Sum of
Squares (variation)– Sum of Squares (SS) is another name for variation
24
Example 2
One-Way ANOVA
• Are all of the sample means (75.71, 67.11, and 53.50) identical?– No, so there is some variation between the groups– This is called the between group variation– Sometimes called the variaton due to the factor– Denoted SSB for Sum of Squares (variation) between the
groups
Drug A B C
Sample size 7 9 8
Mean 75.71 67.11 53.50
Variance 310.90 119.86 80.29
25
Example 2
One-Way ANOVA
– Drug A: 82, 83, 97, 93, 55, 67, 53– Drug B: 83, 78, 68, 61, 77, 54, 69, 51, 63– Drug C: 38, 59, 55, 66, 45, 52, 52, 61
• Are each of the values within each group identical?– No, there is some variation within the groups– This is called the within group variaton– Sometimes called the error variaton– Denoted SSW for Sum of Squares (variation)
within the groups26
Example 2
One-Way ANOVA
• There are two sources of variation
– the variation between the groups, SSB, or the variation due to the factor (real diference)
– the variation within the groups, SSW, or the variation that can’t be explained by the factor so it’s called the error variation (measurement error or random error)
27
One-Way ANOVA
• Here is the basic one-way ANOVA table
Source SS df MS F p
Between
Within
Total
28
Example 2
29
What is the Idea behind ANOVA?
• ANOVA involves the partitioning of the total sum of square (SST)/variance of data into diferent components:– A. sum of square/variance between groups - SSB– B. sum of square/variance within groups - SSW
• More Specifcally, The ANOVA is a method for partitioning the Total Sum of Squares (SST) into two independent parts (within and between groups).
• What is sum of square? (review)
Sum of Squares (SS)
30
• Deviation - The distance from any point (Xi) in a collection of data, to the mean of the data ( )
• = ( )
• Squared deviation – when the deviation is squared = (Xi - )2
• If all such deviatons are squared, then summed, as in , this gives the "sum of squares" for the data
• SS is the sum of n squared deviatons (i = 1 to n)
Review
Sample Variance• The sample variance = sum of squares (SS)
divided by (n-1).
• sample mean sample size• i = 1 to n
31
Review
One-Way ANOVA
• Grand Mean for our example is 65.08
Drug A B C
Sample size 7 9 8
Mean 75.71 67.11 53.50
Variance 310.90 119.86 80.29
32
Example 2
Grand Mean• The grand mean is the average of all the values when the factor is
ignored• It is a weighted average of the individual sample means
One-Way ANOVA
• Between Group Variation, SSB– SSB is the variation between each sample mean and the
grand mean– Each individual variation is weighted by the sample size
• SSB = 1902
Drug A B CSample size 7 9 8
Mean 75.71 67.11 53.50
Variance 310.90 119.86 80.29
33
Example 2
One-Way ANOVA• Within Group Variation, SSW
– The Within Group Variation is the weighted total of the individual variations
– The weighting is done with the degrees of freedom– The df for each sample/group is one less than the
sample size for that sample.
34
One-Way ANOVA
• The within group variation for our example is 3386
Drug A B CSample size 7 9 8
Mean 75.71 67.11 53.50
St. Dev 17.63 10.95 8.96
Variance 310.90 119.86 80.29
35
Example 2
One-Way ANOVA
• The between group df is one less than the number of groups – We have three groups, so df(B) = k-1 = 2
• The within group df is the sum of the individual df’s of each group– The sample sizes are 7, 9, and 8– df(W) = (n1-1) + (n2-1) + (n3-1) = 6 + 8 + 7 = 21
• The total df is one less than the sample size– df(Total) = n1 + n2 + n3 - 1 = n-1 = 24 – 1 = 23
Drug A B C
Sample size 7 9 8
Mean 75.71 67.11 53.50
Variance 310.90 119.86 80.29
36
Example 2
One-Way ANOVA
• Filling in the degrees of freedom gives this …
Source SS df MS F p
Between 1902 2
Within 3386 21
Total 5288 23
37
Example 2
SSTotal = SSB + SSW
One-Way ANOVA
• Variances– The variances are also called the Mean of the Squares and
abbreviated by MS, ofen with an accompanying variable MSB or MSW
– They are an average squared deviation from the mean and are found by dividing the variation by the degrees of freedom
– MS = SS / df• Notice that the MS(Total) or MST is NOT the sum of
MS(Between) or MSB and MS(Within) or MSW.• This works for the sum of squares SS(Total), but not the
mean square MS(Total)
38
One-Way ANOVA• Completing the MS gives …
Source SS df MS F p
Between 1902 2 951.0
Within 3386 21 161.2
Total 5288 23 229.9
39
Example 2
MSB = 1902 / 2 = 951.0 MSW = 3386 / 21 = 161.2 MST = 5288 / 23 = 229.9
One-Way ANOVA
• F test statistic– An F test statistic is the ratio of two sample
variances– The MSB and MSW are two sample variances
and that’s what we divide to fnd F.– F = MSB / MSW
• For our data, F = 951.0 / 161.2 = 5.9• Under null hypothesis, F test statistic follows F
distribution with df1 and df2. where, H0: 1 = 2 =…= k.
40
Example 2
One-Way ANOVA• Adding F to the table …
Source SS df MS F p
Between 1902 2 951.0 5.9
Within 3386 21 161.2
Total 5288 23 229.9
SST=SSB+SSW, df total=dfB+dfW, MST≠ MSB+MSW
41
Example 2
F = MSB/MSW = 951.0 / 161.2 = 5.9
Adjustng for Group Siees
• Divide by the number of degrees of freedom
• F -Test statistic: • if test statstics is large reject H0.• Some times SSG (group) or SSB (between group)
Both are estimates of population variance of error under H0
n: number of observationsK: number of groups
42
Advanced
Test statstc Thresholds
• If populations are normal, with the same variance, then we can show that under the null hypothesis,
• Reject at confdence level α if
The F distribution, with K-1 and n-K degrees of freedom
Find this value in F Table
43
Advanced
• Comparing Types of Variance– The groups overlap quite a bit– The distance between each group mean (between-groups
variance) is smaller than the distance within each group– The diference in the means between the groups is NOT likely
to be statistically signifcant (by one-way ANOVA), as the F-ratio appears to be small
44
• Comparing Types of Variance– The groups do not overlap at all– The distance between each group mean (between-groups
variance) is greater than the distance within each group– The diference in the means between the groups would
likely be found to be statistically signifcant by one-way ANOVA, as the F-ratio appears to be large 45
• An ANOVA table summariees the calculatons leading to the computaton of the F-rato for the ANOVA test.
The ANOVA Table
46
• Large F is likely greater than the critical value and likely significant (Appendix F)
What are the Post Hoc Tests?
• An ANOVA model can only tell us if one or more of the means are statistically signifcantly diferent from the others
• Post-hoc tests are necessary to tell which means are diferent
• These tests are conducted only if the overall ANOVA model (F test) is statistically signifcant
• Decreases likelihood of type 1 error• Figure out which group is diferent• Choice of test depends on type of data (next slide)
47
What are the Post Hoc Tests?
48
• Bonferroni correction• Tukey’s HSD• Sidak
49
Pair-wise Comparison of Groups
• These are the null and alternative hypothesis being tested (3 tests for 3 groups)– H01 : µ1 = µ2, HA1 : µ1 µ2
– H02 : µ1 = µ3, HA2 : µ1 µ3
– H03 : µ2 = µ3, HA3 : µ2 µ3
The ANOVA Table
• Presents the results of the ANOVA test• Called the Summary of ANOVA• Usual table has 6 columns and 3 rows• Degrees of freedom between groups = k-1• Degrees of freedom within groups = n-k
50
• We will illustrate a one-way ANOVA with the following research queston:– Do people with private insurance visit their
physicians (MDs) more frequently than people with no insurance or other types of insurance?
– We will use data from a study of 108 adults to answer this question (n=108)
– We have data on their health insurance (none, Medicare, TriCare, Private) and on the number of MD visits they made in the past year (K=4)
One-Way ANOVA (Pages 159-171)
51
52
Using One-Way ANOVA Procedure in SPSS
• Using One-Way ANOVA• -Test Homogeneity of Variance • - Perform ANOVA• Click Analyze > Compare Means > One-Way ANOVA• Move Outcome (MDvisit) into Dependent List
window• Move Group (Insure) into Factor• In Post_Hoc buton, click Tukey and/or Sidak• In Options buton, check Descriptive and
Homogeneity of variance test• Click Continue, Click OK
53
• Null Hypothesis– H0: None of the groups will difer on the mean
number of visits to the MD• Alternatve Hypothesis (Nondirectonal)
– Ha: At least one of the groups will have a diferent mean number of MD visits
• Note: ANOVA models can only tell us if one or more of the group means difer from the others
• We will need to conduct post hoc tests to determine which groups have diferent means
1. State the Null and Alternative Hypotheses
54
• α-Level– Statistical signifcance will be defned as p≤0.05
• Critcal Value– Using the table of critical values of the F-table,
we fnd that the critical value (df1 = k-1 = 3, df2 = n-k = 104) that defnes the rejection region is 2.70 (Appendix F)
– If the computed F-ratio (F-statistic) is greater than 2.70, we will reject the null hypothesis
2. Define the α-Level and Find the Critical Value
55
• Critcal Value• To fnd the critical value from the F-table, we need the
degrees of freedom for both between the groups and within the groups– The diference between groups = number of groups −
1 = df1• In this case, df1 = 4 − 1 = 3
– The diference within groups = total n − number of groups = df2• In this case, df2 = 108 − 4 = 104
– In the F-table, we use the value at F3,100, which is as close as we can fnd in this table
2. Find the Critical Value
56
• The measures constitute an independent random sample
• The factor “type of insurance” has at least three levels (it has four)
• The dependent variable, “number of visits,” is normally distributed
• The assumption of homogeneity of variance is not violated (per the Levene’s test in SPSS)
• Note: If the data were not normally distributed or the assumption of homogeneity of variance was not met, we could use the Kruskal-Wallis H-test instead
3. Ensure the Data Meet the Assumptions
57
4. Compute the Mean and Standard Deviation for Each Group
Type of Insurance Mean MD Visits Standard Deviaton
None 2.57 1.46
Private 4.46 2.01
Medicare 4.19 1.77
TriCare 4.08 1.82
58
5. Obtain the One-Way ANOVA
59
Descriptive Statistics
60
Post Hoc Tests
61
• Bonferroni correction
• Since the computed F-statistic of 6.772 is greater than the critcal value of 2.70, we conclude that at least some of the means are signifcantly diferent from the other means.
• In short:– Type of insurance is signifcantly associated with the
number of outpatient visits made in a year (at p≤0.05 by one-way ANOVA)
– Post hoc tests revealed that people with no insurance made signifcantly fewer visits to the MD (2.57) than did those with private insurance (4.46), Medicare (4.19), or TriCare (4.08). No other diferences were statistically signifcant
6. Determine Statistical Significance and State a Conclusion
62
• Open data with SPSS.• Select Analyze -> Descriptive Statistics ->
Explore.• From the list on the lef, select the variable
“Mdvists" to the "Dependent List“ and “Insure” to “Factor list”.
• Click “Statistics” on the right to get descriptive statistics.
63
Normality Testng - SPSS
Normality Testng
64
• Click "Plots" on the right.• Click “Histogram” and “Normality plots with tests”.
65
66
• All Skewness and Kurtosis values are within (-2, 2) indicating normal distributions for 4 groups.
67
• Select Analyze -> Compare Means -> One-Way ANOVA
68
• Move Mdvisit into Dependent List window• Move Insure into Factor.
One-Way ANOVA
• On Options menu, check Descriptive and Homogeneity of variance test.
69
• In Post_Hoc click Tukey and Sidak.
70
• Test of homogeneity of variance.• Based on Mean, df1=3, df2=104, P-value=0.451. 4 variances for 4 groups do not have significant
difference.
One-Way ANOVA
71
• One-Way ANOLVA.• Using F-test, between Groups, F-value=6.833, • DF(B) = 3, Df (W) = 104, P-value < 0.003.• At least on group is diferent from others.
One-Way ANOVA
72
One-Way ANOVA
• Compare any two means using Tukey test.• Signifcant diference between group 1 and group 2 (p<0.0001),
group 3 (p=0.005), and group 4 (p=0.012)• No signifcant diference between group 2, 3 and 4
73
Sample siee for One-Way ANOVA
• Choose to get sample size given alpha (0.05), power (80%) and efect size (0.25), 3 groups. N = 158.
Kruskal-Wallis Test• The Kruskal-Wallis test is a nonparametric test and
is used when the assumptions of one-way ANOVA are not met
• The major diference between the Mann-Whitney U and the Kruskal-Wallis H Test is simply that the later can accommodate more than two groups
• Both tests require independent (between-subjects) designs and use summed rank scores to determine the results
• Example: 21 students from 3 programs to evaluate a campus magazine
74
75
Kruskal-Wallis Test (Pages 171-177)
Using Kruskal-Wallis Test Procedure in SPSS
• Click Analyee > Nonparametric Tests > Legacy Dialogs > K Independent Samples.
• Move Score to the Test Variable list window.• Mover Group to the Grouping Variable box.• Click on Group, then click on Defne Groups
(minimum = 1, maximum = 3). • In Option, check Descriptive and Quartiles• Click Continue, Click OK
76
Kruskal-Wallis Test
• The Kruskal-Wallis test is a nonparametric test and is used when the assumptions of one-way ANOVA are not met.
• The major diference between the Mann-Whitney U and the Kruskal-Wallis H (KW test) is simply that the later can accommodate more than two groups.
• Both tests require independent (between-subjects) designs and use summed rank scores to determine the results.
77
Kruskal-Wallis Test (Pages 124-131)
78
• Click Analyee > Nonparametric Tests > Legacy Dialogs > K Independent Samples.
79
• Move Score to the Test Variable list window.• Mover Group to the Grouping Variable box.• Click on Group, then click on Defne Groups (minimum =
1, maximum = 3).
80
• In Options, check “Descriptive”.
Kruskal-Wallis Test (Pages 124-131)
81
Kruskal-Wallis Test (Pages 124-131)
• H0: No difference between the ranks of three groups.• H1: There is a statistically significant difference among
three groups.
82
Kruskal-Wallis Test (Pages 124-131)
• P-value = 0.014 for KW test. There is a significant difference.
Published Paper
83
• Comparisons between hospice and hospital groups (with LCP and without LCP) in quality of care were conducted using one-way between-groups analysis of variance (ANOVA)
• LCP - Liverpool Care Pathway for the Dying Patient
Outcomes
84
• Four key composite scales (Ward Environment, Care, Facilities, and Communication) were created by grouping question items together that represented a similar conceptual theme and had ordinal response options(Table 2)
• Four composite variables were created from questions that had conceptual similarity around the themes of symptom control and spiritual need (Symptom Control, Symptom Management, Spiritual Need - Patient, and Spiritual Need - Next-of-Kin) (Table 3)
Table 2
85
• Hospice participants had the highest scores for all the composite scales, and ‘‘hospital without LCP’’ participants had the lowest scores
Table 3
86
Objectives1. Determine when N-Way ANOVA is
appropriate2. Understand why we would test for
interactions3. Explain appropriate use of MANOVA4. Quiz 3 in the class
87
Lecture 8 - N-Way ANOVA and MANOVA (Chapter 8)
• Homework 2 (Questions will be on SOLE soon).
88