trigseas {jumps} | R Documentation |
Trigonometric seasonal variables
Description
It produces a matrix with seasonal sinusoids to be used as
regressors. By default, for t=1,\ldots,n
and
j = 1, \ldots, \lfloor s/2\rfloor
, it computes
\cos(2\pi j/s), \qquad \sin(2\pi j/s)
. Notice that if $s$ is even the sine function at highest frequency is omitted because it equals zero for all $t$. The used can select a different set of harmonics.
Usage
trigseas(n, s, harmonics = NULL)
Arguments
n |
length of time series; |
s |
seasonal period; |
harmonics |
vector of harmonics to be used: the cosine and sine
functions are computed at frequencies |
Value
It returns a matrix with n rows and so many columns
as the harmonics (by default these are s-1
).
Examples
y <- log(AirPassengers)
X <- trigseas(length(y), 12)
X <- cbind(X, t = 1:length(y))
reg <- lm(y~X)
[Package jumps version 1.0 Index]