Learn R Programming

MALDIquant (version 1.7)

savitzkyGolay: Savitzky-Golay Smoothing Filter

Description

This function applies a Savitzky-Golay filter.

Usage

savitzkyGolay(y, halfWindowSize=10, polynomialOrder=3)

Arguments

y
intensity values
halfWindowSize
half window size. The resulting window reaches from mass[currentIndex-halfWindowSize] to mass[currentIndex+halfWindowSize] (window size is 2*halfWindowSize+1).
polynomialOrder
polynomial order of Savitzky-Golay Filter.

Value

  • double, a smoothed intensity vector.

Details

halfWindowSize: Should be lower than FWHM of peaks (full width at half maximum; please find details in Bromba and Ziegler 1981).

References

A. Savitzky and M. J. Golay. 1964. Smoothing and differentiation of data by simplified least squares procedures. Analytical chemistry, 36(8), 1627-1639.

M. U. Bromba and H. Ziegler. 1981. Application hints for Savitzky-Golay digital smoothing filters. Analytical Chemistry, 53(11), 1583-1586.

See Also

movingAverage, MassSpectrum, transformIntensity,AbstractMassObject-method

Examples

Run this code
## load library
library("MALDIquant")

## 5 point savitzky-golay filter
savitzkyGolay(rep(1:5, times=2), halfWindowSize=2)
# 1 2 3 4.43 3.71 2.29 1.57 3 4 5

## load example data
data("fiedler2009subset", package="MALDIquant")

## smooth spectra
s <- transformIntensity(fiedler2009subset, savitzkyGolay, halfWindowSize=12)

Run the code above in your browser using DataLab