harmonic: Construct harmonic functions for fitting harmonic trend model
Description
The function creates a matrix of the first m pairs of harmonic functions for
fitting a harmonic trend
(cosine-sine trend, Fourier regresssion) models with the response
being x, a time series.
Usage
harmonic(x, m = 1)
Arguments
x
a time series
m
the number of pairs of harmonic functions to be created; 2m must be
less than or equal to the frequency of x
Value
a matrix consisting of \(\cos(2k \pi t), \sin(2k \pi t), k=1,2,...,m,\)
excluding any zero functions.
# NOT RUN {data(tempdub)
# first creates the first pair of harmonic functions and then fit the modelhar.=harmonic(tempdub,1)
model4=lm(tempdub~har.)
summary(model4)
# }