smooth_whittaker {alkahest} R Documentation

Whittaker Smoothing

Description

Whittaker Smoothing

Usage

smooth_whittaker(x, y, ...)

## S4 method for signature 'numeric,numeric'
smooth_whittaker(x, y, lambda = 1600, d = 2, sparse = FALSE)

## S4 method for signature 'ANY,missing'
smooth_whittaker(x, 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. lambda An integer giving the smoothing parameter. The larger lambda is, the smoother the curve. d An integer specifying the order of the penalty. sparse A logical scalar: should sparse matrices be used for computation? If TRUE, Matrix is required.

Value

Returns a list with two components x and y.

N. Frerebeau

References

Eilers, P. H. C. (2003). A Perfect Smoother. Analytical Chemistry, 75(14): 3631-36. doi:10.1021/ac034173t.

Other smoothing methods: smooth_likelihood(), smooth_loess(), smooth_rectangular(), smooth_savitzky(), smooth_triangular()

Examples

## Simulate data with some noise
x <- seq(-4, 4, length = 100)
y <- dnorm(x) + rnorm(100, mean = 0, sd = 0.01)

## Plot spectrum
plot(x, y, type = "l", xlab = "", ylab = "")

## Rectangular smoothing
unweighted <- smooth_rectangular(x, y, m = 3)
plot(unweighted, type = "l", xlab = "", ylab = "")

## Triangular smoothing
weighted <- smooth_triangular(x, y, m = 5)
plot(weighted, type = "l", xlab = "", ylab = "")

## Loess smoothing
loess <- smooth_loess(x, y, span = 0.75)
plot(loess, type = "l", xlab = "", ylab = "")

## Savitzkyâ€“Golay filter
savitzky <- smooth_savitzky(x, y, m = 21, p = 2)
plot(savitzky, type = "l", xlab = "", ylab = "")

## Whittaker smoothing
whittaker <- smooth_whittaker(x, y, lambda = 1600, d = 2)
plot(whittaker, type = "l", xlab = "", ylab = "")


[Package alkahest version 1.1.1 Index]