unit 4 inference for numerical variables lecture 3 anova
play

Unit 4: Inference for numerical variables Lecture 3: ANOVA - PowerPoint PPT Presentation

Unit 4: Inference for numerical variables Lecture 3: ANOVA Statistics 101 Thomas Leininger June 10, 2013 Announcements Announcements Proposals due tomorrow. Will be returned to you by Wednesday. You MUST complete the proposal process. A few


  1. Unit 4: Inference for numerical variables Lecture 3: ANOVA Statistics 101 Thomas Leininger June 10, 2013

  2. Announcements Announcements Proposals due tomorrow. Will be returned to you by Wednesday. You MUST complete the proposal process. A few things to watch out for: Data is plural, data set is singular. Avoid using population data - if you have population data, you might consider taking a random sample. Exploratory analysis: should include some summary statistics and some graphics AND interpretations. If using existing data, find out how your data were collected, and discuss the sampling method as well as any possible biases. Scope of inference: generalizability & causality. Statistics 101 (Thomas Leininger) U4 - L3: ANOVA June 10, 2013 2 / 34

  3. ANOVA Aldrin in the Wolf River The Wolf River in Tennessee flows past an abandoned site once used by the pesticide industry for dumping wastes, including chlordane (pesticide), aldrin, and dieldrin (both insecticides). These highly toxic organic compounds can cause various cancers and birth defects. The standard methods to test whether these substances are present in a river is to take samples at six-tenths depth. But since these compounds are denser than water and their molecules tend to stick to particles of sediment, they are more likely to be found in higher concentrations near the bottom than near mid-depth. Statistics 101 (Thomas Leininger) U4 - L3: ANOVA June 10, 2013 3 / 34

  4. ANOVA Aldrin in the Wolf River Data Aldrin concentration (nanograms per liter) at three levels of depth. aldrin depth 1 3.80 bottom 2 4.80 bottom ... 10 8.80 bottom 11 3.20 middepth 12 3.80 middepth ... 20 6.60 middepth 21 3.10 surface 22 3.60 surface ... 30 5.20 surface Statistics 101 (Thomas Leininger) U4 - L3: ANOVA June 10, 2013 4 / 34

  5. ANOVA Aldrin in the Wolf River Exploratory analysis Aldrin concentration (nanograms per liter) at three levels of depth. bottom middepth surface 3 4 5 6 7 8 9 n mean sd bottom 10 6.04 1.58 middepth 10 5.05 1.10 surface 10 4.20 0.66 overall 30 5.1 0 1.37 Statistics 101 (Thomas Leininger) U4 - L3: ANOVA June 10, 2013 5 / 34

  6. ANOVA Aldrin in the Wolf River Research question Is there a difference between the mean aldrin concentrations among the three levels? To compare means of 2 groups we use a Z or a T statistic. To compare means of 3+ groups we use a new test called ANOVA and a new statistic called F . Statistics 101 (Thomas Leininger) U4 - L3: ANOVA June 10, 2013 6 / 34

  7. ANOVA Aldrin in the Wolf River Recap: 2-sample CIs and HTs n mean sd bottom 10 6.04 1.58 middepth 10 5.05 1.10 surface 10 4.20 0.66 overall 30 5.1 0 1.37 � s 2 s 2 HT: T df = (¯ x 1 − ¯ x 2 ) − null value where SE = n 1 + 1 2 n 2 and SE df = min ( n 1 − 1 , n 2 − 1 ) x 2 ) ± t ⋆ CI: (¯ x 1 − ¯ df × SE Application exercise: Perform a HT and construct a CI for each difference. Statistics 101 (Thomas Leininger) U4 - L3: ANOVA June 10, 2013 7 / 34

  8. ANOVA Aldrin in the Wolf River ANOVA ANOVA is used to assess whether the mean of the outcome variable is different for different levels of a categorical variable. H 0 : The mean outcome is the same across all categories, µ 1 = µ 2 = · · · = µ k , where µ i represents the mean of the outcome for observations in category i . H A : At least one mean is different than others. Statistics 101 (Thomas Leininger) U4 - L3: ANOVA June 10, 2013 8 / 34

  9. ANOVA Aldrin in the Wolf River Conditions The observations should be independent within and between 1 groups If the data are a simple random sample, this condition is satisfied. Carefully consider whether the between-group data is independent (e.g. no pairing). Always important, but sometimes difficult to check. The observations within each group should be nearly normal. 2 Especially important when the sample sizes are small. How do we check for normality? The variability across the groups should be about equal. 3 Especially important when the sample sizes differ between groups. How can we check this condition? Statistics 101 (Thomas Leininger) U4 - L3: ANOVA June 10, 2013 9 / 34

  10. ANOVA Aldrin in the Wolf River z / t test vs. ANOVA - Purpose ANOVA z/t test Compare the means from two or Compare means from two groups more groups to see whether they to see whether they are so far are so far apart that the observed apart that the observed difference differences cannot all reasonably cannot reasonably be attributed to sampling variability. be attributed to sampling variability. H 0 : µ 1 = µ 2 H 0 : µ 1 = µ 2 = · · · = µ k H A : µ 1 � µ 2 H A : µ 1 < µ 2 H A : At least one mean is different H A : µ 1 > µ 2 Statistics 101 (Thomas Leininger) U4 - L3: ANOVA June 10, 2013 10 / 34

  11. ANOVA Aldrin in the Wolf River z / t test vs. ANOVA - Method z/t test ANOVA Compute a test statistic (a ratio). Compute a test statistic (a ratio). z / t = (¯ x 1 − ¯ x 2 ) − ( µ 1 − µ 2 ) F = variability bet. groups SE (¯ x 1 − ¯ x 2 ) variability w/in groups Large test statistics lead to small p-values. If the p-value is small enough H 0 is rejected, and we conclude that the population means are not equal. Statistics 101 (Thomas Leininger) U4 - L3: ANOVA June 10, 2013 11 / 34

  12. ANOVA Aldrin in the Wolf River z / t test vs. ANOVA With only two groups t-test and ANOVA are equivalent, but only if we use a pooled standard variance in the denominator of the test statistic. With more than two groups, ANOVA compares the sample means to an overall grand mean . Statistics 101 (Thomas Leininger) U4 - L3: ANOVA June 10, 2013 12 / 34

  13. ANOVA Aldrin in the Wolf River Hypotheses Question What are the correct hypotheses for testing for a difference between the mean aldrin concentrations among the three levels? (a) H 0 : µ B = µ M = µ S H A : µ B � µ M � µ S (b) H 0 : µ B � µ M � µ S H A : µ B = µ M = µ S (c) H 0 : µ B = µ M = µ S H A : At least one mean is different. (d) H 0 : µ B = µ M = µ S = 0 H A : At least one mean is different. (e) H 0 : µ B = µ M = µ S H A : µ B > µ M > µ S Statistics 101 (Thomas Leininger) U4 - L3: ANOVA June 10, 2013 13 / 34

  14. ANOVA ANOVA and the F test Test statistic Does there appear to be a lot of variability within groups? How about between groups? F = variability bet. groups variability w/in groups Statistics 101 (Thomas Leininger) U4 - L3: ANOVA June 10, 2013 14 / 34

  15. ANOVA ANOVA and the F test F distribution and p-value F = variability bet. groups variability w/in groups In order to be able to reject H 0 , we need a small p-value, which requires a large F statistic. In order to obtain a large F statistic, variability between sample means needs to be greater than variability within sample means. Statistics 101 (Thomas Leininger) U4 - L3: ANOVA June 10, 2013 15 / 34

  16. ANOVA ANOVA output, deconstructed Df Sum Sq Mean Sq F value Pr( > F) ( G roup) depth 2 16.96 8.48 6.13 0.0063 ( E rror) Residuals 27 37.33 1.38 T otal 29 54.29 Degrees of freedom associated with ANOVA groups: df G = k − 1, where k is the number of groups total: df T = n − 1, where n is the total sample size error: df E = df T − df G df G = k − 1 = 3 − 1 = 2 df T = n − 1 = 30 − 1 = 29 df E = 29 − 2 = 27 Statistics 101 (Thomas Leininger) U4 - L3: ANOVA June 10, 2013 16 / 34

  17. ANOVA ANOVA output, deconstructed Df Sum Sq Mean Sq F value Pr( > F) ( G roup) depth 2 16.96 8.48 6.13 0.0063 ( E rror) Residuals 27 37.33 1.38 T otal 29 54.29 Sum of squares between groups, SSG Measures the variability between groups k � x ) 2 SSG = n i (¯ x i − ¯ i = 1 where n i is each group size, ¯ x i is the average for each group, ¯ x is the overall (grand) mean. � 10 × ( 6 . 04 − 5 . 1 ) 2 � SSG = n mean � 10 × ( 5 . 05 − 5 . 1 ) 2 � + bottom 10 6.04 middepth 10 5.05 � 10 × ( 4 . 2 − 5 . 1 ) 2 � + surface 10 4.2 = overall 30 5.1 16 . 96 Statistics 101 (Thomas Leininger) U4 - L3: ANOVA June 10, 2013 17 / 34

  18. ANOVA ANOVA output, deconstructed Df Sum Sq Mean Sq F value Pr( > F) ( G roup) depth 2 16.96 8.48 6.13 0.0063 ( E rror) Residuals 27 37.33 1.38 T otal 29 54.29 Sum of squares total, SST Measures the total variability n � SST = ( x i − ¯ x ) i = 1 where x i represents each observation in the dataset. ( 3 . 8 − 5 . 1 ) 2 + ( 4 . 8 − 5 . 1 ) 2 + ( 4 . 9 − 5 . 1 ) 2 + · · · + ( 5 . 2 − 5 . 1 ) 2 = SST ( − 1 . 3 ) 2 + ( − 0 . 3 ) 2 + ( − 0 . 2 ) 2 + · · · + ( 0 . 1 ) 2 = = 1 . 69 + 0 . 09 + 0 . 04 + · · · + 0 . 01 = 54 . 29 Statistics 101 (Thomas Leininger) U4 - L3: ANOVA June 10, 2013 18 / 34

  19. ANOVA ANOVA output, deconstructed Df Sum Sq Mean Sq F value Pr( > F) ( G roup) depth 2 16.96 8.48 6.13 0.0063 ( E rror) Residuals 27 37.33 1.38 T otal 29 54.29 Sum of squares error, SSE Measures the variability within groups: SSE = SST − SSG SSE = 54 . 29 − 16 . 96 = 37 . 33 Statistics 101 (Thomas Leininger) U4 - L3: ANOVA June 10, 2013 19 / 34

  20. ANOVA ANOVA output, deconstructed Df Sum Sq Mean Sq F value Pr( > F) ( G roup) depth 2 16.96 8.48 6.13 0.0063 ( E rror) Residuals 27 37.33 1.38 T otal 29 54.29 Mean square error Mean square error is calculated as sum of squares divided by the de- grees of freedom. = 16 . 96 / 2 = 8 . 48 MSG MSE = 37 . 33 / 27 = 1 . 38 Statistics 101 (Thomas Leininger) U4 - L3: ANOVA June 10, 2013 20 / 34

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend