Statistics: Unlocking the Power of Data Lock 5 STAT 101 Dr. Kari Lock Morgan 11/1/12 ANOVA SECTION 8.1 Testing for a difference in means across multiple.

Slides:



Advertisements
Similar presentations
Statistics: Unlocking the Power of Data Lock 5 STAT 101 Dr. Kari Lock Morgan ANOVA SECTION 8.1 Testing for a difference in means across multiple categories.
Advertisements

Chi-Square Tests 3/14/12 Testing the distribution of a single categorical variable :  2 goodness of fit Testing for an association between two categorical.
Statistics: Unlocking the Power of Data Lock 5 Testing Goodness-of- Fit for a Single Categorical Variable Kari Lock Morgan Section 7.1.
BPS - 5th Ed. Chapter 241 One-Way Analysis of Variance: Comparing Several Means.
Hypothesis Testing Steps in Hypothesis Testing:
Chapter 14, part D Statistical Significance. IV. Model Assumptions The error term is a normally distributed random variable and The variance of  is constant.
Statistics: Unlocking the Power of Data Lock 5 STAT 101 Dr. Kari Lock Morgan 10/23/12 Sections , Single Proportion, p Distribution (6.1)
Hypothesis Testing: Intervals and Tests
Hypothesis Testing I 2/8/12 More on bootstrapping Random chance
ANOVA: Analysis of Variation
1 1 Slide © 2009, Econ-2030 Applied Statistics-Dr Tadesse Chapter 10: Comparisons Involving Means n Introduction to Analysis of Variance n Analysis of.
Copyright ©2011 Brooks/Cole, Cengage Learning Analysis of Variance Chapter 16 1.
Analysis of Variance: Inferences about 2 or More Means
Today’s Agenda Review of ANOVA Module 9 Review for Exam 2 Please log in with your UMID and your participation will be graded by the number of questions.
STAT 101 Dr. Kari Lock Morgan Exam 2 Review.
Statistics: Unlocking the Power of Data Lock 5 STAT 101 Dr. Kari Lock Morgan Simple Linear Regression SECTIONS 9.3 Confidence and prediction intervals.
Inference for Categorical Variables 2/29/12 Single Proportion, p Distribution Intervals and tests Difference in proportions, p 1 – p 2 One proportion or.
Introducing Inference with Simulation Methods; Implementation at Duke University Kari Lock Morgan Department of Statistical Science, Duke University
Statistics: Unlocking the Power of Data Lock 5 Inference for Proportions STAT 250 Dr. Kari Lock Morgan Chapter 6.1, 6.2, 6.3, 6.7, 6.8, 6.9 Formulas for.
ANOVA 3/19/12 Mini Review of simulation versus formulas and theoretical distributions Analysis of Variance (ANOVA) to compare means: testing for a difference.
Statistics: Unlocking the Power of Data Lock 5 Hypothesis Testing: Hypotheses STAT 101 Dr. Kari Lock Morgan SECTION 4.1 Statistical test Null and alternative.
Chapter 12: Analysis of Variance
AM Recitation 2/10/11.
Chapter 13: Inference in Regression
HAWKES LEARNING SYSTEMS math courseware specialists Copyright © 2010 by Hawkes Learning Systems/Quant Systems, Inc. All rights reserved. Chapter 14 Analysis.
STAT 3130 Statistical Methods I Session 2 One Way Analysis of Variance (ANOVA)
1 1 Slide © 2006 Thomson/South-Western Slides Prepared by JOHN S. LOUCKS St. Edward’s University Slides Prepared by JOHN S. LOUCKS St. Edward’s University.
1 Tests with two+ groups We have examined tests of means for a single group, and for a difference if we have a matched sample (as in husbands and wives)
1 1 Slide © 2005 Thomson/South-Western Chapter 13, Part A Analysis of Variance and Experimental Design n Introduction to Analysis of Variance n Analysis.
1 1 Slide Analysis of Variance Chapter 13 BA 303.
Using Lock5 Statistics: Unlocking the Power of Data
Comparing Two Population Means
Analysis of Variance ( ANOVA )
Analysis of Variance ST 511 Introduction n Analysis of variance compares two or more populations of quantitative data. n Specifically, we are interested.
Introducing Inference with Simulation Methods; Implementation at Duke University Kari Lock Morgan Department of Statistical Science, Duke University
1 1 Slide Simple Linear Regression Coefficient of Determination Chapter 14 BA 303 – Spring 2011.
ANOVA (Analysis of Variance) by Aziza Munir
Basic concept Measures of central tendency Measures of central tendency Measures of dispersion & variability.
Statistics: Unlocking the Power of Data Lock 5 STAT 101 Dr. Kari Lock Morgan Multiple Regression SECTIONS 9.2, 10.1, 10.2 Multiple explanatory variables.
Statistics: Unlocking the Power of Data Lock 5 Normal Distribution STAT 101 Dr. Kari Lock Morgan 10/18/12 Chapter 5 Normal distribution Central limit theorem.
1 Chapter 13 Analysis of Variance. 2 Chapter Outline  An introduction to experimental design and analysis of variance  Analysis of Variance and the.
Statistics: Unlocking the Power of Data Lock 5 Hypothesis Testing: Cautions STAT 250 Dr. Kari Lock Morgan SECTION 4.3, 4.5 Type I and II errors (4.3) Statistical.
Multiple Regression I 4/9/12 Transformations The model Individual coefficients R 2 ANOVA for regression Residual standard error Section 9.4, 9.5 Professor.
Chapter 19 Analysis of Variance (ANOVA). ANOVA How to test a null hypothesis that the means of more than two populations are equal. H 0 :  1 =  2 =
Inference after ANOVA, Multiple Comparisons 3/21/12 Inference after ANOVA The problem of multiple comparisons Bonferroni’s Correction Section 8.2 Professor.
Introducing Inference with Bootstrapping and Randomization Kari Lock Morgan Department of Statistical Science, Duke University with.
ANALYSIS OF VARIANCE STAT 200. OUTLINE Introduction of concepts without numbers, notation or details Motivation The four steps: Hypothesis in words The.
Bayesian Inference, Review 4/25/12 Frequentist inference Bayesian inference Review The Bayesian Heresy (pdf)pdf Professor Kari Lock Morgan Duke University.
Statistics: Unlocking the Power of Data Lock 5 Exam 2 Review STAT 101 Dr. Kari Lock Morgan 11/13/12 Review of Chapters 5-9.
1 Objective Compare of two population variances using two samples from each population. Hypothesis Tests and Confidence Intervals of two variances use.
Statistics: Unlocking the Power of Data Lock 5 STAT 101 Dr. Kari Lock Morgan 10/30/12 Chi-Square Tests SECTIONS 7.1, 7.2 Testing the distribution of a.
AP Statistics: ANOVA Section 1. In section 13.1 A, we used a t-test to compare the means between two groups. An ANOVA (ANalysis Of VAriance) test is used.
Statistics: Unlocking the Power of Data Lock 5 STAT 250 Dr. Kari Lock Morgan SECTION 7.1 Testing the distribution of a single categorical variable : χ.
Statistics: Unlocking the Power of Data Lock 5 STAT 101 Dr. Kari Lock Morgan 11/20/12 Multiple Regression SECTIONS 9.2, 10.1, 10.2 Multiple explanatory.
Statistics: Unlocking the Power of Data Lock 5 Inference for Means STAT 250 Dr. Kari Lock Morgan Sections 6.4, 6.5, 6.6, 6.10, 6.11, 6.12, 6.13 t-distribution.
Econ 3790: Business and Economic Statistics Instructor: Yogesh Uppal
Econ 3790: Business and Economic Statistics Instructor: Yogesh Uppal
Section 6.4 Inferences for Variances. Chi-square probability densities.
Statistics: Unlocking the Power of Data Lock 5 Inference for Means STAT 250 Dr. Kari Lock Morgan Sections 6.4, 6.5, 6.6, 6.10, 6.11, 6.12, 6.13 t-distribution.
Synthesis and Review 2/20/12 Hypothesis Tests: the big picture Randomization distributions Connecting intervals and tests Review of major topics Open Q+A.
Statistics: Unlocking the Power of Data Lock 5 Inference for Proportions STAT 250 Dr. Kari Lock Morgan Chapter 6.1, 6.2, 6.3, 6.7, 6.8, 6.9 Formulas for.
Statistics: Unlocking the Power of Data Lock 5 STAT 250 Dr. Kari Lock Morgan SECTION 7.1 Testing the distribution of a single categorical variable : 
1/54 Statistics Analysis of Variance. 2/54 Statistics in practice Introduction to Analysis of Variance Analysis of Variance: Testing for the Equality.
 List the characteristics of the F distribution.  Conduct a test of hypothesis to determine whether the variances of two populations are equal.  Discuss.
The 2 nd to last topic this year!!.  ANOVA Testing is similar to a “two sample t- test except” that it compares more than two samples to one another.
ANOVA: Analysis of Variation
ANOVA: Analysis of Variation
AP Statistics FINAL EXAM ANALYSIS OF VARIANCE.
Econ 3790: Business and Economic Statistics
Chapter 10 – Part II Analysis of Variance
Presentation transcript:

Statistics: Unlocking the Power of Data Lock 5 STAT 101 Dr. Kari Lock Morgan 11/1/12 ANOVA SECTION 8.1 Testing for a difference in means across multiple categories

Statistics: Unlocking the Power of Data Lock 5 What Next? If you have enjoyed learning how to analyze data, and want to learn more: take STAT 210 (Regression Analysis) Applied, focused on data analysis Recommended for any major involving data analysis Only prerequisite is STAT 101 If you like math and want to learn more of the mathematical theory behind what we’ve learned: take STAT 230 (Probability) and then STAT 250 (Mathematical Statistics) Prerequisite: multivariable calculus

Statistics: Unlocking the Power of Data Lock 5 Two Options for p-values We have learned two ways of calculating p-values: The only difference is how to create a distribution of the statistic, assuming the null is true: 1)Simulation (Randomization Test): Directly simulate what would happen, just by random chance, if the null were true 2)Formulas and Theoretical Distributions: Use a formula to create a test statistic for which we know the theoretical distribution when the null is true, if sample sizes are large enough

Statistics: Unlocking the Power of Data Lock 5 Two Options for Intervals We have learned two ways of calculating intervals: 1)Simulation (Bootstrap): Assess the variability in the statistic by creating many bootstrap statistics 2)Formulas and Theoretical Distributions: Use a formula to calculate the standard error of the statistic, and use the normal or t- distribution to find z* or t*, if sample sizes are large enough

Statistics: Unlocking the Power of Data Lock 5 Inference Which way did you prefer to learn inference? a)Simulation methods b)Formulas and theoretical distributions

Statistics: Unlocking the Power of Data Lock 5 Inference Which way gave you a better conceptual understanding of confidence intervals and p-values? a)Simulation methods b)Formulas and theoretical distributions

Statistics: Unlocking the Power of Data Lock 5 Inference Which way do you prefer to do inference? a)Simulation methods b)Formulas and theoretical distributions

Statistics: Unlocking the Power of Data Lock 5 Pros and Cons 1)Simulation Methods PROS: Methods tied directly to concepts, emphasizing conceptual understanding Same procedure for every statistic No formulas or theoretical distributions to learn and distinguish between Works for any sample size Minimal math needed CONS: Need entire dataset (if quantitative variables) Need a computer Newer approach, so different from the way most people do statistics

Statistics: Unlocking the Power of Data Lock 5 Pros and Cons 2)Formulas and Theoretical Distributions PROS: Only need summary statistics Only need a calculator The approach most people take CONS: Plugging numbers into formulas does little for conceptual understanding Many different formulas and distributions to learn and distinguish between Harder to see the big picture when the details are different for each statistic Doesn’t work for small sample sizes Requires more math and background knowledge

Statistics: Unlocking the Power of Data Lock 5 Two Options If the sample size is small, you have to use simulation methods If the sample size is large, you can use whichever method you prefer It is redundant to use both methods, unless you want to check your answers

Statistics: Unlocking the Power of Data Lock 5 Accuracy The accuracy of simulation methods depends on the number of simulations (more simulations = more accurate) The accuracy of formulas and theoretical distributions depends on the sample size (larger sample size = more accurate) If the sample size is large and you have generated many simulations, the two methods should give essentially the same answer

Statistics: Unlocking the Power of Data Lock 5 Multiple Categories So far, we’ve learned how to do inference for a difference in means IF the categorical variable has only two categories Today, we’ll learn how to do hypothesis tests for a difference in means across multiple categories

Statistics: Unlocking the Power of Data Lock 5 Hypothesis Testing 1.State Hypotheses 2.Calculate a statistic, based on your sample data 3.Create a distribution of this statistic, as it would be observed if the null hypothesis were true 4.Measure how extreme your test statistic from (2) is, as compared to the distribution generated in (3) test statistic

Statistics: Unlocking the Power of Data Lock 5 Cuckoo Birds Cuckoo birds lay their eggs in the nests of other birds When the cuckoo baby hatches, it kicks out all the original eggs/babies If the cuckoo is lucky, the mother will raise the cuckoo as if it were her own uckoo-cuckoo / Do cuckoo birds found in nests of different species differ in size?

Statistics: Unlocking the Power of Data Lock 5 Length of Cuckoo Eggs

Statistics: Unlocking the Power of Data Lock 5 Notation k = number of groups n j = number of units in group j n = overall number of units = n 1 + n 2 + … + n k

Statistics: Unlocking the Power of Data Lock 5 Cuckoo Eggs k = 5 n 1 = 15, n 2 = 60, n 3 = 16, n 4 = 14, n 5 = 15 n = 120 BirdSample Mean Sample SD Sample Size Pied Wagtail Pipit Robin Sparrow Wren Overall

Statistics: Unlocking the Power of Data Lock 5 Hypotheses To test for a difference in means across k groups:

Statistics: Unlocking the Power of Data Lock 5 Test Statistic Why can’t use the familiar formula to get the test statistic? More than one sample statistic More than one null value We need something a bit more complicated…

Statistics: Unlocking the Power of Data Lock 5 Difference in Means Whether or not two means are significantly different depends on How far apart the means are How much variability there is within each group

Statistics: Unlocking the Power of Data Lock 5 Difference in Means

Statistics: Unlocking the Power of Data Lock 5 Analysis of Variance Analysis of Variance (ANOVA) compares the variability between groups to the variability within groups Total Variability Variability Between Groups Variability Within Groups

Statistics: Unlocking the Power of Data Lock 5 Analysis of Variance If the groups are actually different, then a)the variability between groups should be higher than the variability within groups b)the variability within groups should be higher than the variability between groups If the groups are different, there will be high variability between the groups.

Statistics: Unlocking the Power of Data Lock 5 Discoveries for Today How to measure variability between groups? How to measure variability within groups? How to compare the two measures? How to determine significance?

Statistics: Unlocking the Power of Data Lock 5 Discoveries for Today How to measure variability between groups? How to measure variability within groups? How to compare the two measures? How to determine significance?

Statistics: Unlocking the Power of Data Lock 5 Sums of Squares We will measure variability as sums of squared deviations (aka sums of squares) familiar?

Statistics: Unlocking the Power of Data Lock 5 Sums of Squares Total Variability Variability Between Groups Variability Within Groups overall mean data value i overall mean mean in group j i th data value in group j Sum over all data valuesSum over all groups Sum over all data values

Statistics: Unlocking the Power of Data Lock 5 Deviations Group 1 Group 2 Overall Mean Group 1 Mean

Statistics: Unlocking the Power of Data Lock 5 Sums of Squares Total Variability Variability Between Groups Variability Within Groups SST (Total sum of squares) SSG (sum of squares due to groups) SSE (“Error” sum of squares)

Statistics: Unlocking the Power of Data Lock 5 Cuckoo Birds

Statistics: Unlocking the Power of Data Lock 5 Source Groups Error Total df k-1 n-kn-k n-1 Sum of Squares SSG SSE SST Mean Square MSG = SSG/(k-1) MSE = SSE/(n-k) ANOVA Table The “mean square” is the sum of squares divided by the degrees of freedom variability average variability

Statistics: Unlocking the Power of Data Lock 5 ANOVA Table Fill in the beginnings of the ANOVA table based on the Cuckoo birds data. Source Groups Error Total df k-1 n-kn-k n-1 Sum of Squares SSG SSE SST Mean Square MSG = SSG/(k-1) MSE = SSE/(n-k) BirdSample Mean Sample SD Sample Size Pied Wagtail Pipit Robin Sparrow Wren Overall SSG = 35.9 SSE =

Statistics: Unlocking the Power of Data Lock 5 Source Groups Error Total df Sum of Squares Mean Square 35.9/4 = /115 = 0.88 ANOVA Table Fill in the beginnings of the ANOVA table based on the Cuckoo birds data.

Statistics: Unlocking the Power of Data Lock 5 Discoveries for Today How to measure variability between groups? How to measure variability within groups? How to compare the two measures? How to determine significance?

Statistics: Unlocking the Power of Data Lock 5 F-Statistic The F-statistic is a ratio of the average variability between groups to the average variability within groups

Statistics: Unlocking the Power of Data Lock 5 Source Groups Error Total df k-1 n-kn-k n-1 Sum of Squares SSG SSE SST Mean Square MSG = SSG/(k-1) MSE = SSE/(n-k) F Statistic MSG MSE ANOVA Table

Statistics: Unlocking the Power of Data Lock 5 Cuckoo Eggs Source Groups Error Total df Sum of Squares Mean Square 35.9/4 = /115 = 0.88 F Statistic 8.97/0.88 = 10.19

Statistics: Unlocking the Power of Data Lock 5 F-statistic If there really is a difference between the groups, we would expect the F-statistic to be a)Higher than we would observe by random chance b)Lower than we would observe by random chance If the null hypothesis is true, what kind of F- statistics would we observe just by random chance? The numerator of the F-statistic measures between group variability, and the denominator measures within group. If there is a difference, we expect the between group variability to be higher.

Statistics: Unlocking the Power of Data Lock 5 Discoveries for Today How to measure variability between groups? How to measure variability within groups? How to compare the two measures? How to determine significance?

Statistics: Unlocking the Power of Data Lock 5 How to determine significance? We have a test statistic. What else do we need to perform the hypothesis test? A distribution of the test statistic assuming H 0 is true How do we get this? Two options: 1)Simulation 2)Distributional Theory

Statistics: Unlocking the Power of Data Lock 5 Simulation Because a difference would make the F- statistic higher, calculate proportion in the upper tail An F-statistic this large would be very unlikely to happen just by random chance if the means were all equal, so we have strong evidence that the mean lengths of cuckoo birds in nests of different species are not all equal.

Statistics: Unlocking the Power of Data Lock 5 F-distribution

Statistics: Unlocking the Power of Data Lock 5 F-Distribution If the following conditions hold, 1.Sample sizes in each group are large (each n j ≥ 30) OR the data are relatively normally distributed 2.Variability is similar in all groups 3.The null hypothesis is true then the F-statistic follows an F-distribution The F-distribution has two degrees of freedom, one for the numerator of the ratio (k – 1) and one for the denominator (n – k)

Statistics: Unlocking the Power of Data Lock 5 Equal Variance The F-distribution assumes equal within group variability for each group As a rough rule of thumb, this assumption is violated if the standard deviation of one group is more than double the standard deviation of another group

Statistics: Unlocking the Power of Data Lock 5 F-distribution Can we use the F-distribution to calculate the p-value for the Cuckoo bird eggs? a)Yes b)No c)Need more information The equal variability condition is satisfied, but the sample sizes are small so we can only use the F-distribution if the data is normal. BirdSample Mean Sample SD Sample Size Pied Wagtail Pipit Robin Sparrow Wren Overall

Statistics: Unlocking the Power of Data Lock 5 Length of Cuckoo Eggs

Statistics: Unlocking the Power of Data Lock 5 F-distribution p-values 1.StatKey – simulation or theoretical 2.RStudio: tail.p(“f”,stat,df1,df2,tail=“upper”) 3.TI-83: 2 nd  DISTR  7:Fcdf(  lower bound, upper bound, df1, df2 For F-statistics, the p-value (the area as extreme or more extreme) is always the upper tail

Statistics: Unlocking the Power of Data Lock 5 Source Groups Error Total df k-1 n-kn-k n-1 Sum of Squares SSG SSE SST Mean Square MSG = SSG/(k-1) MSE = SSE/(n-k) F Statistic MSG MSE p-value Use F k-1,n-k ANOVA Table

Statistics: Unlocking the Power of Data Lock 5 Cuckoo Eggs

Statistics: Unlocking the Power of Data Lock 5 Source Groups Error Total df Sum of Squares Mean Square F Statistic p-value 4.3 × ANOVA Table We have very strong evidence that average length of cuckoo eggs differs for nests of different species Equal variability Normal(ish) data

Statistics: Unlocking the Power of Data Lock 5 Can we use the F-distribution to calculate the p-value for whether there is a difference in average hours spent studying per week by class year at Duke? a)Yes b)No c)Need more information Study Hours by Class Year YearSample Mean Sample SD Sample Size First Year Sophomore Upperclass The equal variability condition is satisfied, and the sample sizes are large enough (>30)

Statistics: Unlocking the Power of Data Lock 5 Study Hours by Class Year Is there a difference in the average hours spent studying per week by class year at Duke? (a)Yes (b)No (c)Cannot tell from this data (d)I didn’t finish The p-value is 0.29, which means we cannot reject the null, so cannot determine whether there is a difference. YearSample Mean Sample SD Sample Size First Year Sophomore Upperclass

Statistics: Unlocking the Power of Data Lock 5 Source Groups Error Total df Sum of Squares Mean Square F- Statistic 1.24 ANOVA Table p-value 0.29

Statistics: Unlocking the Power of Data Lock 5 Summary Analysis of variance is used to test for a difference in means between groups by comparing the variability between groups to the variability within groups Sums of squares are used to measure variability The F-statistic is the ratio of average variability between groups to average variability within groups The F-statistic follows an F-distribution, if sample sizes are large (or data is normal), variability is equal across groups, and the null hypothesis is true

Statistics: Unlocking the Power of Data Lock 5 To Do Read Section 8.1 Complete the anonymous midterm evaluation by Monday, 11/5, 5pmmidterm evaluation Do Homework 6 (due Tuesday, 11/6)Homework 6