baselineCorrectionQuant {TargetSearch} | R Documentation

## Baseline correction - quantiles method

### Description

This function perform baseline correction using a quantiles around a moving window algorthim.

### Usage

        baselineCorrectionQuant(peaks, time, smooth=0, qntl=0.50, width=30,
                                unit=c("seconds", "points"), steps=10)

### Arguments

`peaks` | Either a matrix object of spectra peak intensities to be baseline corrected, where the rows are retention times and columns are mass traces; or, a named list containing an element called `"Peaks"` which such matrix and another called `"Time"` with the retention time in seconds. The list can be generated by `peakCDFextraction`
`time` | A vector of retention time in seconds. This parameter is used if `peaks` is a matrix. Otherwise, the element called `"Time"` is used instead and this parameter is ignored.
`smooth` | An integer. Smooth each signal by this number of points using a moving average. Smoothing is disabled if this value is less or equal than 1. Note that the smoothing is applied after the baseline correction.
`qntl` | Numeric scalar. The quantile for baseline estimation. The value must be in [0, 1].
`width` | numeric scalar. The size of the window centered around a scan for baseline estimation. The size depends on the parameter `unit` below.
`unit` | A string which chooses if the `width` are points (scans) or seconds.
`steps` | Integer scalar greater than zero. To speed up computation, the baseline algorithm does not compute the baseline estimate in each single scan, but in intervals of `steps` steps. The intermediate points are estimated by simple linear regression.

### Details

Applies a quantile based baseline estimation method. The method is applied for each ion mass trace (column of peaks) individually. It simple computes for each data point of the trace the `qntl` quantile, for example the 50% quantile, ie, the median, of all the points which are within a `width` distance or it.

In order for the method to work, select a `width` much larger than the widest peak.

For speed efficiency, and assuming that the baseline is a smooth curve, the quantiles are computed every `step` points instead. By setting this value to 1, it means compute the baseline for each point. The baseline of the points in between are approximated by linear interpolation.

### Value

Returns a list with the same elements as the the input, but the element `"Peaks"` containing baseline corrected values. In case peaks is a matrix, it returns a matrix of the same dimension instead.

### Author(s)

Alvaro Cuadros-Inostroza

### See Also

`RIcorrect`, `baseline`, `baselineCorrection`

[Package TargetSearch version 1.48.0 Index]