Lowess (locally weighted scatterplot smoothing) is a non-parametric method of smoothing, closely related to nearest neighbor regression. The method uses nearby (in time) points to obtain the smoothed estimate of \(f_t\).

First, a certain proportion of nearest neighbors to \(x_t\) are weighting, where values closer to \(x_t\) in time get more weight. Then, a robust weighted regression is used to predict \(x_t\) and obtain the smoothed estimate of \(f_t\). The degree of smoothing is controlled by the size of the neighborhood. The larger the fraction of nearest neighbors included, the smoother the estimate.

In R lowess is implemented in the lowess() function. The argument f gives the proportion of data points which influence the smoothing at each value. Larger values give more smoothness. The default value is f = 2/3.

library(xts)
load(url("https://userpage.fu-berlin.de/soga/data/r-data/Earth_Surface_Temperature.RData"))
dt <- index(temp_global)
y <- coredata(temp_global)

plot(dt, y, type = "l", col = "gray", xlab = "", ylab = "", 
     main = "Locally weighted scatterplot smoothing (LOWESS)", cex.main = 0.85)

lines(lowess(dt, y), col = "red", type = "l")
lines(lowess(dt, y, f = 0.1), col = "green", type = "l")
lines(lowess(dt, y, f = 0.01), col = "blue", type = "l")

legend("topleft", legend = c("f = 2/3 (default)", "f = 0.1", "f = 0.01"), 
       col = c("red", "green", "blue"), lty = 1, cex = 0.55)


Citation

The E-Learning project SOGA-R was developed at the Department of Earth Sciences by Kai Hartmann, Joachim Krois and Annette Rudolph. You can reach us via mail by soga[at]zedat.fu-berlin.de.

Creative Commons License
You may use this project freely under the Creative Commons Attribution-ShareAlike 4.0 International License.

Please cite as follow: Hartmann, K., Krois, J., Rudolph, A. (2023): Statistics and Geodata Analysis using R (SOGA-R). Department of Earth Sciences, Freie Universitaet Berlin.