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
, 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.


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


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.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+