trigonometric.variables: Trigonometric variables

View source: R/variables.R

trigonometric.variablesR Documentation

Trigonometric variables

Description

Computes trigonometric variables at different frequencies.

Usage

trigonometric.variables(frequency, start, length, s, seasonal_frequency = NULL)

Arguments

frequency

Annual frequency (divisor of 12).

start, length

First date (array with the first year and the first period) (for instance c(1980, 1)) and number of periods of the output variables. Can also be provided with the s argument

s

time series used to get the dates for the trading days variables. If supplied the parameters frequency, start and length are ignored.

seasonal_frequency

the seasonal frequencies. By default the fundamental seasonal frequency and all the harmonics are used.

Details

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}


palatej/rjd3modelling documentation built on Jan. 3, 2023, 10:19 p.m.