baselineCorrection(int, threshold = 0.5, alpha = 0.95, bfraction = 0.2, segments = 100, signalWindow = 10, method = "linear") baseline(ncData, baseline.opts = NULL)
"linear"
(default) uses
linear interpolation. "spline"
fits a cubic smoothing spline (warning: really slow). xcms:::netCDFRawData
baselineCorrection
function. For example baseline.opts = list(threshold = 0.5, alpha = 0.95)
.int
with the baseline corrected intensities.
int
, the signal intensity is filtered
by a first high pass filter: y[i] = alpha * (y[i-1] + x[i] - x[i-1]). The
filtered signal is divided into evenly spaced segments (segments
)
and the standard deviation of each segment is calculated. A percentage (bfraction
)
of the segments with the lowest values are assumed to be baseline signal and the
standard deviation (stdn) of the points within those segments is calculated.Once stdn has been determined, the points with absolute filtered values larger than
2 * stdn are considered signal. After that, the signal windowing step takes
every one of the points found to be signal as the center of a signal window (signalWindow)
and marks the points within that window as signal. The remaining points are now considered
to be noise.
The baseline signal is obtained by either using linear interpolation (default) or fitting a cubic
smoothing spline taking only
the noise. The baseline can be shifted up or down by using the parameter (threshold),
which is done by the formula: B' = B + 2*(threshold - 0.5)*2*stdn, where
B is the fitted spline, stdn the standard deviation of the noise,
and threshold
a value between 0 and 1. Finally, the corrected signal
is calculated by subtracting B' to the original signal.
The baseline
function is called by the function NetCDFPeakFinding
before the peak picking algorithm is performed. Since it is an internal function,
it is not intended to be executed directly.
RIcorrect