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.
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.
All readings on this track · 43 readings
- 1990Constructing dollar baselines from rates, inflation, and residuals
- 1990Constructing a nominal index value from forward earnings and fitted yield
- 1990Constructing a nominal index price from earnings and a fitted yield
- 1990Endpoint-pinned price paths are not forecasts
- 1990Constructing least-squares polynomial smoothers
- 1991Endpoint growth rates versus linear-regression consistency
- 1991Out-of-sample checks for linear growth fits
- 1991Trend as persistence, not a straight line
- 1991Quadratic trend, residual oscillator, and a secondary cycle calendar
- 1991Time-origin offset and residual-price divergence on a quadratic least-squares fit
- 1991A least-squares trendline from ordered prices
- 1992Constructing log-linear growth and reliability screens
- 1992Constructing log-linear growth-rate baselines
- 1992Next-session high, low, and close from rolling linear regression
- 1993Auditing an index price-earnings multiple with short-rate regression
- 1994Regression-seeded nested exponential price filter
- 1994Constructing the double exponential average from lag cancellation
- 1994Evaluating money supply as a linear leading-index baseline
- 1995Constructing least-squares trend channels
- 1995Linear baseline holdout checks for annual bill-rate forecasts
- 1995Projection bands from high and low regression slopes
- 1995Evaluating a least-squares end-point moving average on a known test series
- 1996Constructing an endpoint moving average from a least-squares line
- 1996Scoring equity path consistency with a k-ratio overlay
- 1996Evaluating month-end yield gaps for equity regimes
- 1996Constructing session-indexed standard error bands
- 1998Evaluating linear regression baselines for index valuation
- 1998R-squared as a two-state trend filter from a price-time fit
- 2000Second-order moving-average lag correction
- 2002Price regression line versus beta for index tracking
- 2003Regression slope with an r-squared trend confidence gate
- 2003Constructing finite-volume-element divergence with slope comparison
- 2004Building a daily score from regression, retracement, and volume
- 2004Constructing least-squares trendlines from ordered prices
- 2007Rectangle breakout targets beyond height
- 2007Confirming a price trend with regression slope and r-squared
- 2008A linear-regression angle assembled as one trend filter
- 2010A two-state swing machine from four running extremes
- 2016Score oil-complex tightness before divergence or regression
- 2017Nikkei-yen intermarket divergence as a regime case study
- 2017Constructing Calmar ratio and linear regression baselines
- 2019Pair-trade layer construction versus average-spread management
- 2020A convolution slope built from nested linear regression