lowess Subroutine

public subroutine lowess(x, y, ys, fsmooth, nstps, del, rweights, resid, err)

Computes the smoothing of a data set using a robust locally weighted scatterplot smoothing (LOWESS) algorithm. Fitted values are computed at each of the supplied x values.

Remarks

The code is a reimplementation of the LOWESS library. For a detailed understanding, see [this] (http://www.aliquote.org/cours/2012_biomed/biblio/Cleveland1979.pdf) paper by William Cleveland.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in), dimension(:) :: x

An N-element array containing the independent variable data. This array must be monotonically increasing.

real(kind=real64), intent(in), dimension(:) :: y

An N-element array containing the dependent variable data.

real(kind=real64), intent(out), dimension(:) :: ys

An N-element array where the smoothed results will be written.

real(kind=real64), intent(in), optional :: fsmooth

An optional input that specifies the amount of smoothing.
Specifically, this value is the fraction of points used to compute each value. As this value increases, the output becomes smoother. Choosing a value in the range of 0.2 to 0.8 typically results in a good fit. The default value is 0.2.

integer(kind=int32), intent(in), optional :: nstps

An optional input that specifies the numb of iterations. If set to zero, a non-robust fit is returned. The default value is set to 2.

real(kind=real64), intent(in), optional :: del
real(kind=real64), intent(out), optional, dimension(:), target :: rweights

An optional N-element array, that if supplied, will be used to return the weights given to each data point.

real(kind=real64), intent(out), optional, dimension(:), target :: resid

An optional N-element array, that if supplied, will be used to return the residual.

class(errors), intent(inout), optional, target :: err

A mechanism for communicating errors and warnings to the caller. Possible warning and error codes are as follows. - FS_NO_ERROR: No errors encountered. - FS_ARRAY_SIZE_ERROR: Occurs if any of the arrays are not approriately sized. - FS_MEMORY_ERROR: Occurs if there is a memory allocation error.


Contents