Par

How to forecast with linear regression

Enter pairs of numbers with Σ+, then gŷ,r2 predicts y for any x along the best-fitting line.

Problem

Monthly sales for six months were 112, 118, 127, 131, 140 and 146 units. If the trend continues, what are sales in month 7, and how well does a straight line fit?

Keystrokes

  1. fΣSST
    0.00

    Clears the statistics registers.

  2. 112ENTER1Σ+
    1.00

    Each pair is y, ENTER, then x.

  3. 118ENTER2Σ+
    2.00
  4. 127ENTER3Σ+
    3.00
  5. 131ENTER4Σ+
    4.00
  6. 140ENTER5Σ+
    5.00
  7. 146ENTER6Σ+
    6.00

    Six pairs entered.

  8. 7gŷ,r2
    153.00

    The forecast for month 7.

  9. x≷y
    1.00

    The correlation coefficient.

  10. f4
    0.9969

    Four decimals, to see r more precisely.

  11. f2
    1.00

    Back to two decimals.

Answer

The forecast for month 7 is 153.00 units, and the correlation coefficient is 0.9969.

Why it works

gŷ,r2 fits the least-squares line through the pairs and evaluates it at the x you key. The correlation coefficient r is left in Y. Close to 1 means the points lie almost on a straight line.

gx̂,r1 works the other way: key a y value to find the x where the line reaches it, such as the month sales will pass 180.

Questions

How do I get the slope and intercept?

0 g ŷ,r gives the intercept, the forecast at x = 0. The forecast at x = 1, 1 g ŷ,r, minus the intercept is the slope.

Related