Creates sine and cosine variables to capture intramonthly and intrayearly cycles.
fourier_vars(k =1, l =1, dates)
Arguments
k: Number of pairs of the yearly cycle trigonometric variables
l: Number of pairs of the monthly cycle trigonometric variables
dates: Vector of dates in a date format
Returns
Matrix with fourier variables
Examples
# create a vector of datesdates=seq.Date(from=as.Date("2023-01-02"),by="weeks",length.out =100)# Create a matrix with 20 yearly and 6 monthly pairs of sine and cosine variablesX=fourier_vars(k=20,l=6,dates=dates)