At each target point, LOESS fits a polynomial to the neighbouring data using weighted least squares. The degree parameter controls the order of that polynomial.
The fit at each point is simply a weighted mean. Produces very smooth results but ignores local slope, introducing bias wherever the true function changes.
Use when: Maximum smoothness is more important than accuracy; computationally cheapest option.
\[\hat{y}(x_0) = \arg\min_{a,b} \sum_i w_i(x_0)\,(y_i - a - b x_i)^2\]
Fits a weighted line through the neighbourhood. Removes first-order bias and handles boundary regions correctly. The right choice for the vast majority of applications.
Use when: Default; monotone or gently curved data; boundary accuracy matters.
\[\hat{y}(x_0) = \arg\min_{a,b,c} \sum_i w_i(x_0)\,(y_i - a - b x_i - c x_i^2)^2\]
Fits a weighted parabola through the neighbourhood. Removes second-order bias and captures local curvature more faithfully, but requires more data per neighbourhood — pair with a larger fraction (≥ 0.4) to avoid overfitting.
Use when: Data with pronounced peaks, valleys, or curvature; fraction ≥ 0.4.
\[\hat{y}(x_0) = \arg\min_{a,b,c,d} \sum_i w_i(x_0)\,(y_i - a - b x_i - c x_i^2 - d x_i^3)^2\]
Fits a weighted cubic polynomial. Captures inflection points and S-shaped local behaviour. Requires a substantially larger neighbourhood than degree 2 — use fraction ≥ 0.5 and verify visually for overfitting.
Use when: Data has clear S-shaped curves or multiple inflection points; fraction ≥ 0.5.
\[\hat{y}(x_0) = \arg\min_{a,...,e} \sum_i w_i(x_0)\,(y_i - a - b x_i - \cdots - e x_i^4)^2\]
Fits a weighted quartic polynomial. Rarely needed in practice; only useful for capturing highly oscillatory local structure. Very prone to overfitting — require fraction ≥ 0.6 and cross-validate.
Use when: Fine oscillatory structure is physically meaningful and the dataset is large; always cross-validate.
The surface_mode parameter controls whether LOESS evaluates the local polynomial at every query point or at a sparser grid of vertices with Hermite cubic interpolation in between.
Mode
Behaviour
Speed
Accuracy
"interpolation" (default)
Evaluate at anchor vertices, blend via Hermite cubic