trigonometric.variables | R Documentation |
Computes trigonometric variables at different frequencies.
trigonometric.variables(frequency, start, length, s, seasonal_frequency = NULL)
frequency |
Annual frequency (divisor of 12). |
start, length |
First date (array with the first year and the first period)
(for instance |
s |
time series used to get the dates for the trading days variables. If supplied the
parameters |
seasonal_frequency |
the seasonal frequencies. By default the fundamental seasonal frequency and all the harmonics are used. |
Denote by P the value of frequency
(= the period) and
f_1, ..., f_n the frequencies provides by seasonal_frequency
(if seasonal_frequency = NULL
then n=\lfloor P/2\rfloor and f_i=i).
trigonometric.variables
returns a matrix of size length\times(2n).
For each date t associated to the period m (m\in[1,P]), the columns 2i and 2i-1 are equal to:
\cos ≤ft( \frac{2 π}{P} \times m \times f_i \right) \text{ and } \sin ≤ft( \frac{2 π}{P} \times m \times f_i \right)
Take for example the case when the first date (date
) is a January, frequency = 12
(monthly time series), length = 12
and seasonal_frequency = NULL
.
The first frequency, λ_1 = 2π /12 represent the fundamental seasonal frequency and the
other frequencies (λ_2 = 2π /12 \times 2, ..., λ_6 = 2π /12 \times 6)
are the five harmonics. The output matrix will be equal to:
\begin{pmatrix} \cos(λ_1) & \sin (λ_1) & \cdots & \cos(λ_6) & \sin (λ_6) \newline \cos(λ_1\times 2) & \sin (λ_1\times 2) & \cdots & \cos(λ_6\times 2) & \sin (λ_6\times 2)\newline \vdots & \vdots & \cdots & \vdots & \vdots \newline \cos(λ_1\times 12) & \sin (λ_1\times 12) & \cdots & \cos(λ_6\times 12) & \sin (λ_6\times 12) \end{pmatrix}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.