Let X = {x1, x2,…, xp} be a set of p points (or observations), and let Y = {y1, y2, …, yp} be the corresponding data values.
for i=1 to p do
Let xi be the point to be fitted on the loess curve.
Let D(·) be an appropriate distance metric. For each point xj ∈ X, i≠j, define the distance dj = D(xi,xj).
Let d(1}, d(2), …, d(p) be the ordered set of distances.
Let k be the number of neighbors of xi to be used in the local regression. The value of k is given as a percentage of the number of observations and is called the span of the regression.
-
Define N(xi), the neighborhood of xi, as the set of points closest to xi using the distance metric D:
xj ∈ N(xi) if d(j)<k
-
Define Δ, the maximum distance in the span, as
-
Assign weights wj to each of the points xj
where W(·) is the tri-cube function
Calculate the weighted least squares fit of Y on the neighborhood of X using the weights w.
Let s(·), the smooth function, be given by s(xi) = ŷj at the point xi
end for
|