gettrend | R Documentation |
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.
gettrend(signal, degree = NULL, maxfreq = NULL, time = NULL)
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. |
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 |
getltrend()
, plot.trend()
, time.trend()
, detrended()
, orisignal()
, predict.trend()
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.