1 / 55

One-way ANOVA

One-way ANOVA. Motivating Example Analysis of Variance Model & Assumptions Data Estimates of the Model Analysis of Variance Multiple Comparisons Checking Assumptions One-way ANOVA Transformations. Sample size = n k. Sample size = n 1. Sample size = n 2. Oneway ANOVA.

iniko
Download Presentation

One-way ANOVA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. One-way ANOVA • Motivating Example • Analysis of Variance • Model & Assumptions • Data Estimates of the Model • Analysis of Variance • Multiple Comparisons • Checking Assumptions • One-way ANOVA Transformations

  2. Sample size = nk Sample size = n1 Sample size = n2 Oneway ANOVA If an experiment is conducted randomly allocate units to the k “treatment” groups, otherwise independent samples are taken. Population k mk, sk Population 1m1, s1 Population 2 m2, s2 . . . When sample sizes are unequal we say design is unbalanced When sample sizes are equal we say design is balanced. Independently drawn random samples • Questions: • Do the k population means differ somehow, i.e. are at least two treatment means differ? • If so, which pairs of means differ?

  3. Motivating Example:Treating Anorexia Nervosa • Anorexia patients were randomly assigned to receive one of three different therapies: • Standard – current accepted therapy • Family – family therapy • Behavior – behavioral cognitive therapy • For each patient weight change during the course of the treatment was recorded. The duration of treatment was the same for all patients, regardless of therapy received. Question: Do the patients in the three treatments/ therapies have different mean weight gains?

  4. Motivating Example:Treating Anorexia Nervosa Do the patients in the three treatments/therapies have different mean weight gains?

  5. Analysis of Variance • Analysis of Variance is a widely used statistical technique that partitions the total variability in our data into components of variability that are used to test hypotheses. • In One-way ANOVA, we wish to test the hypothesis: H0: 1= 2= = k against: HA:Not all population means are the same

  6. = m + a + e x ij i ij Model & Assumptions • The model for the observed response is given by: • We assume that the errors are normally distributed with constant variance. • This implies that the populations being sampled are also normally distributed with equal variances!

  7. Analysis of Variance • In ANOVA, we compare the between-group variation with the within-group variation to assess whether there is a difference in the population means. • Thus by comparing these two measures of variance (spread) with one another, we are able to detect if there are true differences among the underlying group population means.

  8. Analysis of Variance • If the variation between the sample means is large, relative to the variation within the samples, then we would be likely to detect significant differences among the sample means.

  9. Between Group Variation is Large Compared to Within Group Variation Between-group variation (group means are diamonds) Within-group variation Here we would almost certainly reject the null hypothesis.

  10. 1 3j= y3j-3 1 2 2 = 2 -  3 3 Analysis of Variance Between-group variation is large compared to the Within-group variation If we sampled from these populations, we would expect to reject H0 

  11. Analysis of Variance • If the variation between the sample means is small, relative to the variation within the samples, then there would be considerable overlap of observations in the different samples, and we would be unlikely to detect any differences among the population means.

  12. Between Group Variation is Small Compared to Within GroupVariation Between-group variation is small Within-group variation is large. Here we would fail to reject the null hypothesis.

  13. 2j= y2j- 2 Analysis of Variance If we sampled from these populations, we would not expect to reject H0 All i = 0  = 1 = 2 = 3

  14. n k i å å - 2 ( x x ) · · ij = = 1 1 i j Analysis of Variance • If we consider all of the data together, regardless of which sample the observation belongs to, we can measure the overall total variability in the data by: • This is the Total Sum of Squares (SSTotal).

  15. n n n k k k i i i å å å å å å - = - + - 2 2 2 ( x x ) ( x x ) ( x x ) · · · · · · ij i ij i = = = = = = i 1 j 1 i 1 j 1 i 1 j 1 Measure variation due to the fact different treatments are used. Measures error variation, variation in response when same treatment is applied. Analysis of Variance • Now, the deviation of every observation from the overall (grand) mean can be partitioned as: - = - + - ( x x ) ( x x ) ( x x ) · · · · · · ij i ij i • Squaring and summing across all observations, we get:

  16. n n n k k k i i i å å å å å å - = - + - 2 2 2 ( x x ) ( x x ) ( x x ) · · · · · · ij i ij i = = = = = = i 1 j 1 i 1 j 1 i 1 j 1 Treatment Sum of Squares (SSTreat) or Between Group Sum of Squares (SSB) Error Sum of Squares (SSError) or Within Group Sum of Squares (SSW) Analysis of Variance • Now, the deviation of every observation from the overall (grand) mean can be partitioned as: - = - + - ( x x ) ( x x ) ( x x ) · · · · · · ij i ij i • Squaring and summing across all observations, we get:

  17. Analysis of Variance On the right-hand side we have the • Between Group Sum of Squares (SSB) or Treatment Sum of Squares (SSTreat) • Within Group Sum of Squares (SSW) or Error Sum of Squares (SSError) • This equation is the ANOVA Identity: SSTotal = SSTreat + SSError • This partitions the Total Sum of Squares into two components of interest for our hypothesis.

  18. TWO ESTIMATES OF THE COMMON VARIANCE Estimate 1: Using Between Group Variation • If the null hypothesis is true each of the represents a randomly selected observation from a normal distribution with mean m (common mean) and std. deviation = , i.e. the standard error of the mean. • Thus if we find the sample variance of the we get an estimate of . • Therefore, is an estimate of s2, if and only if the null hypothesis is true. • However if the alternative hypothesis is true, and there is substantial between group variation, this estimate of s2will be too BIG. This measure of between group variation is called the Mean Square for Treatmentsand is denoted MSTreat. = MSTreat

  19. TWO ESTIMATES OF THE COMMON VARIANCE

  20. TWO ESTIMATES OF THE COMMON VARIANCE • Thus if the null hypothesis is true we have two estimates of the common variance (s2) , namely the Mean Square for Treatments (MSTreat) and the Mean Square Error (MSError) . • If MSTreat >> MSError, i.e. the between group variation is large relative to the within group variation, we reject Ho. • If we fail to reject Ho, i.e. the between group variation is NOT large relative to the within group variation.

  21. MS Treat F = 0 MS Error Analysis of Variance: F-Test Statistic • Our test statistic is the F-ratio (or F-statistic) which compares these two mean squares: Note that the greater the natural variability within the groups, the larger the effects (i)will need to be (as estimated by MSTreat) for us to detect any significant differences.

  22. These cols add up SS/df Source of Degrees of Sum of Mean F- Ratio P-value Variation Freedom Squares Square /MS MS MS SS Tail Area Treatment k – 1 Treat Treat Error Treat N – k SS Error MS Error Error N – SS 1 Total T Analysis of Variance: ANOVA Table • Traditionally the Analysis of Variance calculations have been presented in an ANOVA Table. • The format of the table is:

  23. Motivating Example: Anorexia Treatments Fo = MSTreat/MSError = 307.32/57.68 = 5.42 MSTreat SSTreat = 5.42 + SSError = SSTotal MSError

  24. Analysis of Variance • A large F-statistic provides evidence against H0 while a small F-statistic indicates that the data and H0 are compatible. • To calculate a P-value to test H0, we compare the F-statistic we obtained from our data to the distribution it would have under a true H0, i.e. an F-distribution with (k-1) and (N – k) degrees of freedom. • Note that F0 is always positive, so this is always a one-tailed test.

  25. F-distribution 0.8 0.6 Then the P-value = 0.0065 0.4 0.2 0.0 0 2 4 5 4 Here our observed value for F was F0 = 5.42 Analysis of Variance When H0 is true, F0 ~ F(df1,df2) For example, consider the F-distribution with 2 and 69 df

  26. Analysis of Variance There is very strong evidence against the null hypothesis. We conclude that the mean weight gain of patients in the three therapy programs significantly differ (p = .0065).

  27. ( ) æ ö - k k ! k k 1 ç ÷ = = ç ÷ - 2 2 ! ( k 2 )! 2 è ø Multiple Comparisons • A significant F-test tells us that at least two of the underlying population means are different, but it does not tell us which ones differ from the others. • We need extra tests to compare all the means, which we call Multiple Comparisons. • We look at the difference between every pair of group population means, as well as the confidence interval for each difference. • When we have k groups, there are: possible pair-wise comparisons. k choose 2

  28. ( ) æ ö - k k ! k k 1 ç ÷ = = ç ÷ - 2 2 ! ( k 2 )! 2 è ø Multiple Comparisons • So why don’t we just perform all possible pair-wise comparisons of the form (mi vs. mj) using tests and CI’s? • Because the more tests we conduct the better the chance we have of finding a significant difference even when in reality there are NO population differences.

  29. Why Multiple Comparisons? • In 1980, researchers at Duke randomized 1073 heart disease patients into two groups, but treated the groups equally. • Not surprisingly, there was no difference in survival. • Then they divided the patients into 18 subgroups based on prognostic factors. • In a subgroup of 397patients (with three-vessel disease and an abnormal leftventricular contraction) survival of those in “group 1” was significantly different from survival of those in “group 2” (p<.025). • How could this be since there was no treatment? (Lee et al. “Clinical judgment and statistics: lessons from a simulated randomized trial in coronary artery disease,” Circulation, 61: 508-515, 1980.)

  30. Multiple Comparisons • The difference resulted from thecombined effect of small imbalances in the distribution of severalprognostic factors. • Another subgroup was identified in which a significantsurvival difference was not explained by multivariable methods (just chance). • Conclusion: “Clinicians should be aware of problems that occur when a patientsample is subdivided and treatment effects are assessed within multipleprognostic categories.”

  31. Multiple Comparisons • By using a p-value of 0.05 as the criterion for significance, we’re accepting a 5% chance of a false positive (of calling a difference significant when it really isn’t). • If we compare survival of “treatment” and “control” within each of 18 subgroups, that’s 18 comparisons. • If these comparisons were independent, the chance of at least one false positive would be…

  32. Multiple Comparisons With 18 independent comparisons, we have 60% chance of at least 1 false positive. With 60 comparisons it’s over a 95% chance.

  33. Multiple Comparisons With 18 independent comparisons, we expect about 1 false positive. Similarly with 60 comparisons we expect to find 3 false positives and with 100 comparisons we expect 5.

  34. Multiple Comparisons • If we estimate each comparison separately with 95% confidence, the overall error rate will be greater than 5%. • So, using ordinary pair-wise comparisons (i.e. lots of individualpooled t-tests), we tend to find too many significant differences between our sample means. • We need to modify our intervals so that they simultaneously contain the true differences with 95% confidence across the entire set of comparisons. • These modified intervals and tests are known as: simultaneous confidence methods OR multiple comparison procedures

  35. Multiple Comparisons • First we consider the Bonferroni correction. • Instead of using a for determining our confidence intervals (e.g. a = .05  95%) we use a/m, where m is the total number of possible pair-wise comparisons (i.e. m =k (k - 1) / 2). • For testing we compare our two-tailed p-values from pair-wise comparisons to /m instead. • This assumes all pair-wise comparisons are independent, which is not the case, so this adjustment is too conservative (intervals will be too wide; i.e. finds too few significant differences).

  36. Multiple Comparisons • As a better alternative we have Tukey Intervals. • The calculation of Tukey Intervals is quite complicated, but overcomes the problems of the unadjusted pair-wise comparisons finding too many significant differences (i.e. confidence intervals that are too narrow), and the Bonferroni correction finding too few significant differences (i.e. confidence intervals that are too wide). We will use Tukey Intervals and pair-wise tests

  37. Tukey Pair-wise Comparisons In JMP selectCompare Means > All Pairs, Tukey HSD HSD = honest significant difference

  38. Tukey Pair-wise Comparisons SelectCompare Means > All Pairs, Tukey HSD Only Behavioral and Standard therapies significantly differ as they are not connected by the same letter, e.g. Behavioral and Family therapies do not significantly differ as they both have an “A” next to them.

  39. Tukey Pair-wise Comparisons SelectCompare Means > All Pairs, Tukey HSD These CI’s contain 0. Here we see that only Behavioral and Standard therapies differ in terms of mean weight gain as the other CI’s contain 0. We estimate those in behavioral therapy will gain between 2.09 lbs. and 13.34 lbs. more on average than those receiving standard therapy.

  40. Checking Assumptions: Independence • The observations within each sample must be independent of one another. This is determined by how the samples were taken or experiment was conducted. • Observational Studies: the random samples must be taken from independent populations. • Experimental Studies: the experimental units must be randomly allocated to treatment.

  41. Checking Assumptions:Equality of Variance • Equality of variance is very important in One-way ANOVA. • We check equality of variance using Levene’s, Bartlett’s, Brown-Forsythe, or O’Brien’s Tests. • If the assumption of equal population variances is not satisfied (small P-value from these tests), we can try transforming the data or use Welch’s ANOVA which allows the variances to be unequal.

  42. Ho: All population variances are equal. HA: At least two population variances differ None of the p-values suggest the population variances are unequal (p >> .05 for all). Therefore we will assume that the equality of variance assumption is satisfied for these data. Checking Assumptions:Equality of VarianceIn JMP: Oneway Analysis > Unequal Variances

  43. Checking Assumptions:Equality of Variance • For many data sets, we often find there is a relationship between the centre of the data and the spread of the data: • In particular, samples with low means (or medians) often have small spread while samples with large means (or medians) often have large spread (or vice versa). • The positive relationship between the mean and variance (or between the median and midspread) in different samples is often true for data that have right-skewed distributions.

  44. Checking Assumptions:Equality of Variance • If the variance of the samples is increasing as the sample means increase a log or square root transformation is often times used. • However we can only use a log transformation if we wish to be able to back-transform and interpret our confidence intervals meaningfully (see later).

  45. MS Treat F = 0 MS Error Checking Assumptions: Normality • The test statistic (Fo) has an F-distribution only if the k populations are approximately normally distributed. • If sample sizes from the different populations are “large” this assumption is less critical. • If in doubt there are alternative tests that can be used that do not require the normality assumption (see Nonparametric Tests).

  46. Checking Assumptions: Normality To check normality we can add normal quantile plots or histograms to the comparative display of our data.

  47. Example 2: Leucocyte Counts • In this study patients with four grades of colon cancer (A = lowest grade, …., D = highest grade) are compared to healthy controls in terms of average leucocyte count. Questions of Interest: Do white blood cell counts differ between controls and individuals with colon cancer? Do the different grades differ significantly in terms of leucocyte count?

  48. Example 2: Leucocyte Counts (data entry) In JMP - We need two columns to enter the results from a k-population study. One column contains the population or treatment identifier and the other contains the response to be compared across groups. In SPSS – You have to be sure to code the group identifier as a number. Why? I have no idea.

  49. Example 2: Leucocyte Counts Assumptions:1) Independent samples were drawn from the 5 populations of interest.2) Normality looks OK with the exception of a few large outliers.3) Variation looks fairly equal across groups, however the healthy group appears to have less variation in their white blood cell counts.

  50. Example 2: Leucocyte Counts • Formally checking the variance equality assumption.In JMPIn SPSS None of the equality of variance tests provide evidence that the population variances differ significantly across groups (p > .05), e.g. Levene’s Test yields a p-value = .415.

More Related