Announcements: Homework 10: –Due next Thursday (4/25) –Assignment will be on the web by tomorrow night.
Fabric B u r n T i m e Vertical spread of data points within each oval is one type of variability. Vertical spread of the ovals is another type of variability.
Suppose there are k treatments and n data points. ANOVA table: Source Sum ofMean of VariationdfSquaresSquare F P Treatmentk-1SSTMST=SST/(k-1)MST/MSE Errorn-kSSEMSE=SSE/(n-k) Totaln-1total SS ESTIMATE OF “WITHIN FABRIC TYPE” VARIABILITY ESTIMATE OF “ACROSS FABRIC TYPE” VARIABILITY “SUM OF SQUARES” IS WHAT GOES INTO NUMERATOR OF s 2 : “(X 1 -X) 2 + … + (X n -X) 2” P-VALUE FOR TEST OF All Means equal. (REJECT IF LESS THAN )
One-way ANOVA: Burn Time versus Fabric Analysis of Variance for Burn Time Source DF SS MS F P Fabric Error Total Explaining why ANOVA is an analysis of variance: MST = / 3 = Sqrt(MST) describes standard deviation among the fabrics. MSE = / 12 = 1.35 Sqrt(MSE) describes standard deviation of burn time within each fabric type. (MSE is estimate of variance of each burn time.) F = MST / MSE = It makes sense that this is large and p-value = Pr(F 4-1,16-4 > 27.15) = 0 is small because the variance “among treatments” is much larger than variance within the units that get each treatment. (Note that the F test assumes the burn times are independent and normal with the same variance.) For test: H 0 :
It turns out that ANOVA is a special case of regression. We’ll come back to that in a class or two. First, let’s learn about regression (chapters 12 and 13). Simple Linear Regression example: Ingrid is a small business owner who wants to buy a fleet of Mitsubishi sigmas. To save $ she decides to buy second hand cars and wants to estimate how much to pay. In order to do this, she asks one of her employees to collect data on how much people have paid for these cars recently. (From Matt Wand)
Age (years) Regression Plot Data: Each point is a car Price ($)
Plot suggests a simple model: Price of car = intercept + slope times car’s age + error or y i = 0 + 1 x i + i, i = 1,…,39. Estimate 0 and 1. Outline for Regression: 1.Estimating the regression parameters and ANOVA tables for regression 2.Testing and confidence intervals 3.Multiple regression models & ANOVA 4.Regression Diagnostics
Plot suggests a model: Price of car = intercept + slope times car’s age + error or y i = 0 + 1 x i + i, i = 1,…,39. Estimate 0 and 1 with b 0 and b 1. Find these with “least squares”. In other words, find b 0 and b 1 to minimize sum of squared errors: SSE = {y 1 – (b 0 + b 1 x 1 )} 2 + … + {y n – (b 0 + b 1 x n )} 2 See green line on next page. Each term is squared difference between observed y and the regression line ((b 0 + b 1 x 1 )
Squared length of this line contributes one term to Sum of Squared Errors (SSE) This line has length y i – b 0 – b 1 x i for some i Age P r i c e S = R-Sq = 43.8 % R-Sq(adj) = 42.2 % Price = Age Regression Plot
Age (years) S = R-Sq = 43.8 % R-Sq(adj) = 42.2 % General Model: Price = 0 + 1 Age + error Fitted Model: Price = Age Regression Plot Price ($) Do Minitab example
Regression parameter estimates, b 0 and b 1, minimize SSE = {y 1 – (b 0 + b 1 x 1 )} 2 + … + {y – (b 0 + b 1 x n )} 2 Full model is y i = 0 + 1 x i + i Suppose errors ( i ’s) are independent N(0, 2 ). What do you think a good estimate of 2 is? MSE = SSE/(n-2) is an estimate of 2. Note how SSE looks like the numerator in s 2.
(I divided price by $1000. Think about why this doesn’t matter.) Source DF SS MS F P Regression Residual Error Total Sum of Squares Total = {y 1 –mean(y)} 2 + … + {y 39 – mean(y)} 2 = Sum of Squared Errors = {y 1 – (b 0 + b 1 x 1 )} 2 + … + {y – (b 0 + b 1 x n )} 2 = Sum of Squares for Regression = SSTotal - SSE What do these mean?
Overall mean of $3,656 Regression line Age P r i c e S = R-Sq = 43.8 % R-Sq(adj) = 42.2 % Price = Age Regression Plot
(I divided price by $1000. Think about why this doesn’t really matter.) Source DF SS MS F P Regression 1=p Residual Error 37=n-p Total 38=n p is the number of regression parameters (2 for now) SSTotal = {y 1 –mean(y)} 2 + … + {y 39 – mean(y)} 2 = SSTotal / 38 is an estimate of the variance around the overall mean. (i.e. variance in the data without doing regression) SSE = {y 1 – (b 0 + b 1 x 1 )} 2 + … + {y – (b 0 + b 1 x n )} 2 = MSE = SSE / 37 is an estimate of the variance around the line. (i.e. variance that is not explained by the regression) SSR = SSTotal – SSE MSR = SSR / 1 is the variance the data that is “explained by the regression”.
(I divided price by $1000. Think about why this doesn’t really matter.) Source DF SS MS F P Regression 1=p Residual Error 37=n-p Total 38=n p is the number of regression parameters A test of H 0 : 1 = 0 versus H A : parameter is not 0 Reject if the variance explained by the regression is high compared to the unexplained variability in the data. Reject if F is large. F = MSR / MSE p-value is Pr(F p-1,n-p > MSR / MSE) Reject H 0 for any less than the p-value (Assuming errors are independent and normal.)
R2R2 Another summary of a regression is: R 2 =Sum of Squares for Regression Sum of Squares Total 0<= R 2 <= 1 This is the percentage of the of variation in the data that is described by the regression.
Two different ways to assess “worth” of a regression 1.Absolute size of slope: bigger = better 2.Size of error variance: smaller = better 1.R 2 close to one 2.Large F statistic