You are on page 1of 2

FORMULA FOR LEAST SQUARES REGRESSION

In the textbook, you saw how a spreadsheet function was readily used to calculate the slope and intercept for a data set. As a matter of curiosity, you may wonder about the embedded calculations. To wit:

b = (n(XY) - (X)(Y))/(n(X2 ) - (X)2) a = ((Y) - b(X))/n a = intercept term b = slope x = independent variable from X axis (activity level) y = dependent variable resulting on Y axis (cost) n = number of observations -- means to sum all observations
Let's see how these formulas are applied to the data set from the chapter. The following illustration repeats the data used within the chapter (including cells B22:B24 that include the 2 spreadsheet-based functions for the intercept, slope, and R value). The red values on row 18 are sums of data for the applicable column. In addition, cells E22:E24 include intercept, slope, 2 and R from the formulas noted in the comment boxes. Obviously, they match the results obtained with the much simpler built-in functions. If you are highly curious, you can take time to match cell references in the comment boxes to the above formulas. If you are wildly curious, you 2 might even perform a detailed comparison to the appropriate manual formula for calculating R that follows the illustration!

R: [n(xy) - (x)(y)] ([(nx2) - (x)2] [(ny2) - (y)2])0.5

R2 = R(R)

You might also like