Learn R Programming

sysid (version 1.0.4)

detrend: Remove offsets and linear trends

Description

Removes offsets or trends from data

Usage

detrend(x, type = 0)

Arguments

x
an object of class idframe
type
argument indicating the type of trend to be removed (Default=0)
  • type=0: Subtracts mean value from each signal
  • type=1: Subtracts a linear trend (least-squres fit)
  • type=trInfo object: Subtracts a trend specified by the object

Value

A list containing two objects: the detrended data and the trend information

Details

R by default doesn't allow return of multiple objects. The %=% operator and g function in this package facillitate this behaviour. See the examples section for more information.

See Also

lm

Examples

Run this code
data(cstr)
datatrain <- dataSlice(cstr,end=4500)
datatest <- dataSlice(cstr,4501)
g(Ztrain,tr) %=% detrend(datatrain) # Remove means
g(Ztest) %=% detrend(datatest,tr)

Run the code above in your browser using DataLab