Skip to main content
Track Linear regression
5 / 43
Library

1990issue C121-7

Constructing least-squares polynomial smoothers

A least-squares polynomial smoother is a local linear-regression fit. Place it beside a moving-average baseline and an exponential-smoothing baseline, then size the window by reading leftover structure in the residual series.

  • A least-squares smoother is a linear-regression fit that minimizes squared vertical gaps between observed prices and the fitted curve, assigning all error to the price axis and none to the time axis.
  • A long moving average reduces extreme peaks and troughs, while exponential smoothing and other asymmetric weighting schemes introduce some shape distortion relative to a symmetric least-squares fit.
  • The fitted midpoint can be obtained from an integer-weight window; tabulated sets cover second- through fifth-order polynomials and windows from 5 to 25 observations.
  • Window length is a construction choice that should follow inspection of leftover structure in the residual series, because a longer window can add phase delay and change what variation remains.
Entries in this reading3 entries

A linear-regression construction

A least-squares smoother is built as a linear-regression fit. The fit chooses coefficients so the squared vertical gaps between observed prices and the fitted values are minimized. All error is assigned to the price axis and none to the time axis.

Polynomial order is the degree of that local fitted curve. The construction requires evenly spaced sampling and a series that is continuous enough to treat as a smooth curve.

Moving-average and exponential-smoothing baselines

Place this construction beside two baselines that use the same ordered observations. A moving average averages a block of those observations. When that block is long, it tends to flatten sharp peaks and troughs and, relative to the least-squares construction, a long moving average reduces extreme peaks and troughs.

Exponential smoothing applies decaying, asymmetric weights. Relative to a symmetric least-squares fit, exponential smoothing and other asymmetric weighting schemes introduce some shape distortion and shift the shape of turning points.

An integer-weight window

The fitted midpoint can be obtained by multiplying a window of observations by a fixed integer weight set and dividing by a published normalizing factor. That integer-weight window is a compact implementation of the polynomial fit.

Tabulated sets cover second- through fifth-order polynomials and windows from 5 to 25 observations. Second- and third-order sets form one tabulated family, and fourth- and fifth-order sets form another.

The five-point second- and third-order weight set is symmetric about its midpoint and expands from the folded table as -3, 12, 17, 12, and -3.

Sample series versus five-point centered least-squares fit

The raw sample climbs from 9 to 17, sags through the middle teens, then runs up to 20. The five-point centered least-squares line stays almost in phase and only clips the sharpest corners, which is the point of the integer-weight construction. Points are the Period, Data, and Centered least squares columns from the article's Figure 1 worksheet.
The raw sample climbs from 9 to 17, sags through the middle teens, then runs up to 20. The five-point centered least-squares line stays almost in phase and only clips the sharpest corners, which is the point of the integer-weight construction. Points are the Period, Data, and Centered least squares columns from the article's Figure 1 worksheet.

Centered values use the five-point quadratic/cubic integers −3, 12, 17, 12, −3 divided by 35. Periods 1–2 and 22–23 have no centered fit because the window needs two observations on each side.

Five-point and 25-point windows on weekly yields

On weekly intermediate-term bond yields from 6 March 1987 through 12 January 1990, a five-point second- and third-order smoother kept the main highs and lows nearly in phase with the raw series, including the week-34 peak tied to the 19 October 1987 market reaction.

The matching 25-point second- and third-order smoother delayed tall, sharp peaks and troughs by about two to three weeks. That later appearance of the same turns is phase delay. The longer window also spread the week-34 peak toward later observations and left shallow turns near weeks 66 and 110 without that delay.

What the residual series removed

The residual series is the pointwise difference between the raw observations and the smoothed series. It shows how much variation was removed and whether leftover structure remains.

The five-point residual removed about plus or minus 0.1 percent yield at the week-34 spike, confined that burst to about four weeks, and otherwise left background fluctuations near plus or minus 0.03 percent yield plus a roughly regular plus or minus 0.05 percent jump every 17 to 25 weeks.

The 25-point residual removed about plus or minus 0.3 percent yield at the same spike, raised background residual amplitude to about plus or minus 0.1 percent yield, stretched that peak residual toward week 50, and showed a larger leftover oscillation near 30-week spacing.

Sizing the window from leftover structure

Window length is a construction choice that should follow inspection of leftover structure in the residual. After that inspection, the smoother can sit in front of later analysis as a way to decide how much variation, and of what kind, to remove.

Educational research material, not investment advice. Historical source context does not establish present-day performance.
5 of 43 in the Linear regression track
19911-5 pp.Next on Linear regressionEndpoint growth rates versus linear-regression consistencySix constructed earnings series can all open at 1.00 and close at 2.00 after five years and still follow different year-by-year paths. That is path dependence.
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