Skip to contents

Baseline estimation by iterative mean suppression.

Usage

baseline_peakfilling(x, y, ...)

# S4 method for numeric,numeric
baseline_peakfilling(x, y, n, m, by = 10, lambda = 1600, d = 2, sparse = FALSE)

# S4 method for ANY,missing
baseline_peakfilling(x, n, m, by = 10, lambda = 1600, d = 2, sparse = FALSE)

Arguments

x, y

A numeric vector. If y is missing, an attempt is made to interpret x in a suitable way (see grDevices::xy.coords()).

...

Currently not used.

n

An integer value giving the number of iterations.

m

An odd integer giving the half window size.

by

A length-one numeric vector giving the umber of buckets to divide x into.

lambda

An integer giving the smoothing parameter. The larger lambda is, the smoother the curve (see smooth_whittaker()).

d

An integer specifying the order of the penalty (see smooth_whittaker()).

sparse

A logical scalar: should sparse matrices be used for computation (see smooth_whittaker())? If TRUE, Matrix is required.

Value

Returns a list with two components x and y.

References

Liland, K. H. (2015). 4S Peak Filling - baseline estimation by iterative mean suppression. MethodsX, 2, 135-140. doi:10.1016/j.mex.2015.02.009 .

Author

N. Frerebeau

Examples

## X-ray diffraction
data("XRD")

## 4S Peak Filling baseline
baseline <- baseline_peakfilling(XRD, n = 10, m = 5, by = 10, sparse = TRUE)

plot(XRD, type = "l", xlab = expression(2*theta), ylab = "Count")
lines(baseline, type = "l", col = "red")