How Loess Works

Loess (or lowess, Locally Weighted Scatterplot Smoothing) is a scatterplot smoother, which provides a flexible method for nonparametric regression.
Elements in the graphic:
• blue points: data points under the smoother
• black points: data points not under the smoother
• black curve: the loess smoother
• dark red dot: the loess fit at the current position
• dark red line or curve: the loess curve with parameters fixed at those corresponding to the red dot
• purple bars: window shape and the corresponding loess weights, with scale indicated on the right axis
Controls:
, the position at which the point on the loess curve is calculated. As you slide , notice how the window width changes. The number of points in the window, whose positions are indicated by the green bars, remains constant.
, the fraction of data under the smoother. As increases, the window width increases and more smoothing is done.
indicates the degree of the local polynomial.

SNAPSHOTS

  • [Snapshot]
  • [Snapshot]
  • [Snapshot]
  • [Snapshot]
  • [Snapshot]

DETAILS

Given bivariate observations , , the basic model that can be fitted may be written as
, ,
where and is a local polynomial of degree , which may be written as
.
The parameters are estimated by weighted least squares for each value of . The weight function weights the data, , so that data values near to have greater weight than those farther away from . Following [1], we use the tricube weight function,
with to define the local neighborhood weights for the data at the point .
Here and controls the amount of smoothing (larger values of result in more smoothing). As , for each , and the local linear model reduces to the standard parametric polynomial regression. For , is the distance to the nearest neighbor, where ( is the integer part function). Hence, , where denotes the largest value of , . For , . It follows that as , the local linear model reduces to a parametric polynomial regression of degree .
In practice we work with local constant loess, ; local linear, , or local quadratic, .
[1] W. S. Cleveland, Visualizing Data, New Jersey: Summit, 1993.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.