Learn R Programming

MALDIquant (version 1.8)

.savitzkyGolay: Savitzky-Golay Smoothing Filter

Description

This function applies a Savitzky-Golay filter. It is hidden by NAMESPACE because it is a private function and smoothIntensity,MassSpectrum-method should be used instead.

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

smoothIntensity,MassSpectrum-method, .movingAverage, MassSpectrum

Examples

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

## 5 point savitzky-golay filter
MALDIquant:::.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 <- smoothIntensity(fiedler2009subset, method="SavitzkyGolay",
                     halfWindowSize=12)

Run the code above in your browser using DataLab