Construct harmonic functions for fitting harmonic trend model
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.
harmonic(x, m = 1)
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 |
a matrix consisting of \cos(2k π t), \sin(2k π t), k=1,2,...,m, excluding any zero functions.
Kung-Sik Chan
data(tempdub) # first creates the first pair of harmonic functions and then fit the model har.=harmonic(tempdub,1) model4=lm(tempdub~har.) summary(model4)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.