Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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 π t), \sin(2k π t), k=1,2,...,m, excluding any zero functions.

Author(s)

Kung-Sik Chan

See Also

Examples

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)

TSA

Time Series Analysis

v1.3
GPL (>= 2)
Authors
Kung-Sik Chan, Brian Ripley
Initial release
2020-9-11

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.