LOESS/LOWESS Algorithm

23.08.2021

LOESS and LOWESS filters are very popular smoothing methods that use a locally weighted regression function.

This method uses a weighting function with the effect that the influence of a neighboring value on the smoothed value at a certain position decreases with their distance to that position. Outliers are weighted lower compared to other methods. The important issue is selecting the smoothing width that renders the number of observed values used in calculating a point. In addition, two types of weighting are used: proximity weighting and robust weighting.

Step 1:

In the first step of the method, the range of the points to be included is determined. The number n of these points is specified. The larger this value is, the smoother the adapted curve will be in the end. The range is determined in such a way that exactly n values, including the selected point itself, are in the range, and the selected point is in the center of the selected range. It is thus possible that the number of points to the left and right may differ. For instance, the first value only has neighboring points to the right.

Step 2:

In the second step, the weighting is established for the locally weighted regression smoothing. The weighting function is defined by:

for k = 1,…,N

 

di is the distance from xi to the Nth neighboring point. The weighting function is symmetrical. The largest value is attained at point xi. The value 0 is at the range limits.

Step 3:

Regression smoothing will now take place. A linear regression function based on the least squares method is estimated for the LOWESS procedure. The LOESS procedure on the other hand uses a quadratic function.

The parameters are calculated in such a way that the following function is minimized:

 

LOWESS:

 

LOESS:

 

Step 4:

Only relatively few observed values are included for estimating the linear regression function in the individual ranges. It is always possible in this case that the estimated regression function is more or less strongly influenced by potential outliers. Therefore, robust weightings are determined in a fourth step of the procedure. To determine the weightings, the residuals of the values estimated up to this point and the resulting median are calculated.

Robust weightings are calculated using the following formula:

The robust weighting is 0 if a residual is greater than or equal to 6 m (m = median residuals). This eliminates outliers.

The robust weightings, multiplied with the proximity weightings, are used for re-estimating a linear regression function within the individual ranges:

LOWESS:

LOESS:

 

A series of new smoothed values is the result. The procedure can be repeated several times. The higher the number of iterations, the more precise the curve fitting; however, if an iteration number is already high, increasing it will hardly show any visible improvement.

References

Cleveland, W.S. (1979). Robust Locally Weighted Regression and Smoothing Scatterplots. Journal of the American Statistical Association, Vol. 74, pp. 829-836.

Share article or send as email:

You might be interested in these articles