Skip to main content
Track Linear regression
11 / 43
Library

1991issue C121-6

A least-squares trendline from ordered prices

A least-squares fit through ordered prices is recovered from five worksheet aggregates. A five-observation classroom line is written Y = 1.10 + 0.50X and rises one-half data unit for each one-unit advance in the time index.

  • A least-squares line is the straight line that reduces the sum of the squared vertical deviations of the plotted points to a minimum.
  • Intercept and slope are recovered from five worksheet aggregates: the observation count, the sum of the time index, the sum of the data values, the sum of squared time values, and the sum of time times data.
  • A five-observation classroom worksheet with time total 15, data total 13, squared-time total 55, and time-times-data total 44 yields the line Y = 1.10 + 0.50X.
  • The same construction applies to any count of ordered observations and may slope down as well as up, giving an objective definition of trend.
Entries in this reading1 entry

What the fitted line is

A least-squares fit is the straight line that reduces the sum of the squared vertical deviations of the plotted points to a minimum. The fitted line is written Y = a + bX, with a equal to the vertical intercept when X is zero and b equal to the constant slope.

When the series is a price history against calendar time, the horizontal coordinate is a time index: an integer that counts sampling intervals from the first observation in the chosen lookback. The resulting regression line is a least-squares fit of one ordered series against another.

Five aggregates on the worksheet

The intercept and slope are recovered from five worksheet aggregates: the observation count N, the sum of the time index, the sum of the data values, the sum of squared time values, and the sum of time times data.

A five-observation classroom line

A five-observation worksheet with time total 15, data total 13, squared-time total 55, and time-times-data total 44 yields slope 0.50 and intercept 1.10. That classroom line is Y = 1.10 + 0.50X, rising one-half data unit for each one-unit advance in the time index.

Other placements of the same fit

Placing a stock series on the vertical axis and a broad index on the horizontal axis makes the intercept the series alpha and the slope its beta.

When the data column is a logarithm of prices, a straight center line through the channel represents a constant percentage growth or decline rate.

The same construction can be applied to any count of ordered observations and may slope down as well as up, giving an objective definition of trend.

Educational research material, not investment advice. Historical source context does not establish present-day performance.
11 of 43 in the Linear regression track
19921-10 pp.Next on Linear regressionConstructing log-linear growth and reliability screensBoth earnings and dividends must show a 10% log-linear growth rate estimated from six observations covering five years.
All readings on this track · 43 readings
  1. 1990Constructing dollar baselines from rates, inflation, and residuals
  2. 1990Constructing a nominal index value from forward earnings and fitted yield
  3. 1990Constructing a nominal index price from earnings and a fitted yield
  4. 1990Endpoint-pinned price paths are not forecasts
  5. 1990Constructing least-squares polynomial smoothers
  6. 1991Endpoint growth rates versus linear-regression consistency
  7. 1991Out-of-sample checks for linear growth fits
  8. 1991Trend as persistence, not a straight line
  9. 1991Quadratic trend, residual oscillator, and a secondary cycle calendar
  10. 1991Time-origin offset and residual-price divergence on a quadratic least-squares fit
  11. 1991A least-squares trendline from ordered prices
  12. 1992Constructing log-linear growth and reliability screens
  13. 1992Constructing log-linear growth-rate baselines
  14. 1992Next-session high, low, and close from rolling linear regression
  15. 1993Auditing an index price-earnings multiple with short-rate regression
  16. 1994Regression-seeded nested exponential price filter
  17. 1994Constructing the double exponential average from lag cancellation
  18. 1994Evaluating money supply as a linear leading-index baseline
  19. 1995Constructing least-squares trend channels
  20. 1995Linear baseline holdout checks for annual bill-rate forecasts
  21. 1995Projection bands from high and low regression slopes
  22. 1995Evaluating a least-squares end-point moving average on a known test series
  23. 1996Constructing an endpoint moving average from a least-squares line
  24. 1996Scoring equity path consistency with a k-ratio overlay
  25. 1996Evaluating month-end yield gaps for equity regimes
  26. 1996Constructing session-indexed standard error bands
  27. 1998Evaluating linear regression baselines for index valuation
  28. 1998R-squared as a two-state trend filter from a price-time fit
  29. 2000Second-order moving-average lag correction
  30. 2002Price regression line versus beta for index tracking
  31. 2003Regression slope with an r-squared trend confidence gate
  32. 2003Constructing finite-volume-element divergence with slope comparison
  33. 2004Building a daily score from regression, retracement, and volume
  34. 2004Constructing least-squares trendlines from ordered prices
  35. 2007Rectangle breakout targets beyond height
  36. 2007Confirming a price trend with regression slope and r-squared
  37. 2008A linear-regression angle assembled as one trend filter
  38. 2010A two-state swing machine from four running extremes
  39. 2016Score oil-complex tightness before divergence or regression
  40. 2017Nikkei-yen intermarket divergence as a regime case study
  41. 2017Constructing Calmar ratio and linear regression baselines
  42. 2019Pair-trade layer construction versus average-spread management
  43. 2020A convolution slope built from nested linear regression
All 112 readings tagged Linear regression
Also on Linear regression5 readings