ANOVA Table and Prediction Intervals

9
ANOVA Table and Prediction intervals (note: the actual calculations/formulas are shown below, but on homework and exams you need only read Excel printouts to answer most questions about regression) Step 1: Decide which variable is x and which is y y the variable that depends on the other variable; or, the variable that you are trying to predict x the variable whose values affect the other variable; or, the variable whose values help predict the other variable. Example: Does # units sold depend on price ? y x Or, the problem might be stated as: Use this data to predict the # units sold at a given price y x Step 2: Obtain data: i x y 1 x 1 y 1 2 x 2 y 2 3 x 3 y 3 : : : n x n y n

Transcript of ANOVA Table and Prediction Intervals

Page 1: ANOVA Table and Prediction Intervals

ANOVA Table and Prediction intervals(note: the actual calculations/formulas are shown below, but on homework and exams you need only read Excel printouts to answer most questions about regression)

Step 1: Decide which variable is x and which is y

y the variable that depends on the other variable; or, the variable that you are trying to predict

x the variable whose values affect the other variable; or, the variable whose values help predict the other variable.

Example: Does # units sold depend on price? y x

Or, the problem might be stated as:

Use this data to predict the # units sold at a given price y x

Step 2: Obtain data:

i x y 1 x1 y1

2 x2 y2

3 x3 y3

: : :n xn yn

Example:i x y 1 10 9902 20 9803 30 970 5 values for each variable4 40 950 so, n = 55 50 920

Page 2: ANOVA Table and Prediction Intervals

Step 3: Obtain the five sums

x y xy x2 y2

x1 y1 x1y1 x12 y1

2

x2 y2 x2y2 x22 y2

2

x3 y3 x3y3 x32 y3

2

: : : : : xn yn xnyn xn

2 yn2

___ ___ _____ ___ ___

Example: x y xy x2 y2

10 990 9,900 100 980,10020 980 19,600 400 960,40030 970 29,100 900 940,90040 950 38,000 1,600 902,50050 920 46,000 2,500 846,400___ ____ _______ _____ ________

150 4,810 142,600 5,500 4,630,300

Page 3: ANOVA Table and Prediction Intervals

Step 4: Find the estimated coefficients (note: the actual calculations are shown, but you only need to read Excel printouts for homework and the next exam)

Formulas:

b1 =

b0 =

Example: b1 = = = -1.7

b0 = = = 1,013

Step 5: Find Sums of Squares and s2 (note: the actual calculations are shown, but

you only need to read Excel printouts for homework and the next exam)

Example:

SST = SST = 4,630,300 - (4,810)2 = 3,080

SSR = b1 (numerator of b1) SSR = (-1.7)(-1700) = 2,890

SSE = SST -SSR SSE = 3,080 – 2,890 = 190

s2 = s

2 = = 63.3333

s = s = = 7.958224

Page 4: ANOVA Table and Prediction Intervals

Step 6: Create ANOVA table (note: the actual calculations are shown, but you only need to read Excel printouts for homework and the next exam)

Source d.f. SS MS FRegression 1 SSR MSR = SSR/d.f MSR/MSEError n-2 SSE MSE = SSE/(n-2)Total n-1 SST

Example:

Source d.f. SS MS FRegression 1 2890 2890/1= 2890 45.6316Error 3 190 190/3 = 63.3333Total 4 3080

n=5, so n-2 = 3 and n-1 = 4

Step 7: Conduct F and t tests. (Note: these tests give exactly the same conclusions for Simple Linear Regression; but they differ for Multiple Linear Regression; the F test isexplained in Chapter 17 – page 679) (note: the actual calculations are shown, but you only need to read Excel printouts for homework and the next exam)

H0: 1 = 0 Example: Suppose = .05H1: 1 0

F-statistic = F-statistic = = = 45.6316

Critical (table) F value = F (1 ,n-2) Critical F = F.05 (1 ,3) = 10.13

t-statistic = (d.f. = n -2) t-statistic = = = - 6.75511

where = = = .251661

t/2 = t.025 (d.f. = n-2 = 3) = 3.182denominator in formula for b1

Conclusion: Reject H0; “there is a significant relationship between y and x”

Page 5: ANOVA Table and Prediction Intervals

Step 8: Calculate r2 (note: the actual calculations are shown, but you only need to read Excel printouts for homework and the next exam)

r2 =

Interpretation: r2 is the proportion (or %) of the variation in the y variable that is caused by the changing values of the x variable.

Example:

r2 = = .9383 (or, 93.83%) the y variable

Interpretation: 93.83 % of the variation in the # of units sold can be attributed the changing values of price.

the x variable

Step 9: Use the regression equation for prediction and/or estimation(Prediction and confidence intervals do require a little more than just reading the Excel printout. You need is the sum of squares of the x deviations that appears in the denominator of the fraction under the square root sign - use Excel to calculate this value & then plug it in to the prediction or confidence interval formula)

For a “given” (i.e., particular) value of x (call it xg), the estimated y value for this x value is found by simply putting xg into the estimated regression equation:

= estimated y (when x = xg) = b0 + b1xg

Page 6: ANOVA Table and Prediction Intervals

Confidence Interval for the average of all y values whenever x = xg:

d.f. = n-2

Note: is the denominator of the calculation for b1

Example: to estimate the average sales, for all times in the future when the price is set at xg = $35 using a 95% confidence interval:

= b0 + b1xg = 1013 – 1.7(35) = 953.5

95% confidence = .05 t/2 = t.025 (n-2 = 3 d.f.) = 3.182

Interval = 953.5 = 953.5 12.01175

t/2 s denominator of b1

Prediction Interval for a single y value when x = xg:

the extra “1” under the square root sign d.f. = n-2 is the only difference from the confidence interval formula

Example: to estimate the sales for a particular week in which the price is set at xg = $35 using a 95% prediction interval :

= b0 + b1xg = 1013 – 1.7(35) = 953.5 (same as for conf. interval)

95% confidence = .05 t/2 = t.025 (n-2 = 3 d.f.) = 3.182

Page 7: ANOVA Table and Prediction Intervals

Interval = 953.5 = 953.5 28.02742

t/2 s denominator of b1