An extended version of the loess method

버전 1.0.2 (2.05 KB) 작성자: Mark Brandon
Estimates local regression estimates of y and dy/dx at specified x locations.
다운로드 수: 97
업데이트 날짜: 2020/8/7

라이선스 보기

My contribution here is to provide an extended version of the loess method that allows for estimates at any location within the range of the observed data, and also for estimates of the local slope at those locations. The algorithm also accounts for gaps in the observed data.

The loess method was first introduced by William Cleveland between 1979 and 1996 (see Wikipedia page for details). The method is one of several methods included in the Matlab's smooth function. The method can be used for n-dimensional estimation, but the focus here, and also with the smooth function, is on 1D problems.

Consider a set of observations, yi and xi, where i = 1 to n. The observations of yi are assumed be equal to Yi + ei, where the vector Yi represents "true" values, and the vector ei represents random independent errors.

The loess method estimates the function Y(x) by using a "moving" least-squares fit. The moving fit is applied at specified x locations, and is represented by a 2nd order polynomial fitting function, and tricubic weighting function, both of which are centered on the x location for each estimate. As such, the loess method can be viewed as a moving Taylor-series approximation. A nice aspect of the loess method is that, since it is based on the least squares method, all of the knowledge for that method is directly applicable for understanding and interpreting the loess estimates.

The loess function provided here is generalized to allow for more applications. Usually the loess method only provides estimates at the locations xi for the observations. The function here allows for estimates at any specified location, xq, within the range of the observations. The output includes estimates of Yq and dYq/dx at the specified xq locations. In addition, the code also accounts for gaps in the observations where Yq and dYq/dx cannot be directly estimated.

Note that polynomial least-squares is prone to numerical instabilities, given that the transformation that there are powers of x involved. The least-squares fit in this function is done using the QR decomposition, which should ensure a stable calculation for all problems.

Mark Brandon, Yale University, August 2, 2020

인용 양식

Mark Brandon (2024). An extended version of the loess method (https://www.mathworks.com/matlabcentral/fileexchange/78793-an-extended-version-of-the-loess-method), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2020a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.0.2

Corrected scaling error for estimated derivative, dYdx

1.0.1

Added note about QR decomposition

1.0.0