apaTrendModels.Fourier(series, harmonicCount, includeLinearTrend, nAhead)
=apaTrendModels.Fourier(series, harmonicCount, includeLinearTrend, nAhead)Result
Fits a Fourier harmonic trend regression with intercept to a single series and returns the fitted values and coefficients.
Syntax
series: r x 1 or 1 x r data vector containing a time series
harmonicCount: number of sine/cosine harmonic pairs to include
includeLinearTrend: TRUE to include a linear time trend in addition to the Fourier terms, FALSE otherwise. Default value: FALSE
nAhead: optional number of forecast steps appended after the last observation. Default value: 0
Algorithm
The series is regressed by ordinary least squares on a constant, optionally a linear time trend t, and the terms cos(2πkt/P) and sin(2πkt/P) for k = 1, …, harmonicCount.
Remarks
The result contains a header row and one row per observation with the columns Position (1-based), FittedValue, Period, HarmonicCount, IncludeLinearTrend, R2, RSS and the coefficients Beta0, Beta1, … . If nAhead is greater than 0, nAhead further rows with the Positions r + 1, …, r + nAhead follow, where r is the number of observations. Their FittedValue is the forecast obtained by evaluating the fitted regression at the times t = r, …, r + nAhead − 1; the other columns repeat the fit statistics and coefficients. Since the period P equals the number of observations, the harmonic terms of the forecast repeat the pattern from the start of the series, and only the linear trend, if included, continues the level.
