gettrend: Returns polynomial trend in 'signal' time-serie

View source: R/functions.R

gettrendR Documentation

Returns polynomial trend in 'signal' time-serie

Description

This function detects a polynomial trend of n-th degree and returns it as a vector. The degree is eithe specified by the parameter 'degree' or computed from the paramters 'time' and 'maxfreq' according to the formula d = 2 time maxfreq, where maxfreq is maximum possible frequency of the trend. The time can be recognised if the signal is a time-serie object.

Usage

gettrend(signal, degree = NULL, maxfreq = NULL, time = NULL)

Arguments

signal

A vector or a time-serie object. Time-sorted values of signal containing trend.

degree

A positive natural number. The degree of the trend polynomial.

maxfreq

A positive real number. Maximum possible trend frequency.

time

A positive real number. Time span of the signal in base units.

Value

Returns an object of a class "trend" containing vector of values of the estimated trend.

The object also contains:

values

original values of the signal

detrended

the difference between the original values of the signal and the trend

time

vector of the time domain of the signal

model

model used to predct trend for purpose of estimating the trend on new data

See Also

getltrend(), plot.trend(), time.trend(), detrended(), orisignal(), predict.trend()

Examples

x <- sin(seq(0, 6, length.out=100)) + rnorm(100)
trend1 <- gettrend(x, maxfreq=2, time=1)
detrended(trend1)
predict(trend1, newtime=seq(1, 2, length.out=100))

data(austres)
trend2 <- gettrend(austres, maxfreq=.1)
plot(trend2)

bartekkroczek/detrendeR documentation built on March 26, 2022, 10:40 p.m.