detrend {rchemo}R Documentation

Polynomial de-trend transformation

Description

Polynomial de-trend transformation of row observations (e.g. spectra) of a dataset. The function fits an orthogonal polynom of a given degree to each observation and returns the residuals.

Usage

detrend(X, degree = 1)

Arguments

X

X-data (n, p).

degree

Degree of the polynom.

Details

detrend uses function poly of package stats.

Value

A matrix of the transformed data.

Examples


data(cassav)

X <- cassav$Xtest

degree <- 1
Xp <- detrend(X, degree = degree)

oldpar <- par(mfrow = c(1, 1))
par(mfrow = c(1, 2))
plotsp(X, main = "Signal")
plotsp(Xp, main = "Corrected signal")
abline(h = 0, lty = 2, col = "grey")
par(oldpar)


[Package rchemo version 0.1-2 Index]