50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

alkahest (version 1.3.0)

baseline_asls: Asymmetric Least Squares Smoothing

Description

Baseline estimation with asymmetric least squares smoothing.

Usage

baseline_asls(x, y, ...)

# S4 method for numeric,numeric baseline_asls(x, y, p = 0.01, lambda = 10^4, stop = 100)

# S4 method for ANY,missing baseline_asls(x, p = 0.01, lambda = 10^4, stop = 100)

Value

Returns a list with two components x and y.

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.

p

A length-one numeric vector giving the asymmetry (0.001<p<0.1 is a good choice for a signal with positive peaks).

lambda

A length-one numeric vector giving the smoothing parameter.

stop

An integer giving the stopping rule (i.e. maximum number of iterations).

Author

P. H. C. Eilers and H. F. M. Boelens (original Matlab code)

References

Eilers, P. H. C. & Boelens, H. F. M. (2005). Baseline Correction with Asymmetric Least Squares Smoothing.

See Also

signal_correct()

Other baseline estimation methods: baseline_linear(), baseline_peakfilling(), baseline_polynomial(), baseline_rollingball(), baseline_rubberband(), baseline_snip()

Examples

Run this code
## X-ray diffraction
data("XRD")

## Subset from 20 to 70 degrees
XRD <- signal_select(XRD, from = 20, to = 70)

## Plot spectrum
plot(XRD, type = "l", xlab = expression(2*theta), ylab = "Count")

## Polynomial baseline
baseline <- baseline_asls(XRD, p = 0.005, lambda = 10^7)

lines(baseline, type = "l", col = "red")

Run the code above in your browser using DataLab