Harmonic Fit to Time Series
harmonicfit.RdThis function fit an k-harmonic function to time series data.
Arguments
- x
An object of class `utilities`.
- ...
Additional arguments for pairing time series:
- data
A data frame with three columns corresponding to the time, values, and standard errors of the irregularly observed time series.
- f1
frequency (1 / period) of the time series.
- nham
Number of harmonic components in the model.
- weighted
logical; if true, a weighted least squares (WLS) estimation is performed using weights based on the standard deviations of the errors. Default is 'FALSE'.
- remove_trend
logical; if true, the linear trend of time series will be removed before the the harmonic model is fitted.
Value
An object of class `utilities` with the slots:
- fitted_values
Fitted values from the harmonic model.
- residuals
Residuals from the harmonic model.
- coef
Estimated coefficients of the harmonic model.
- summary
A summary object containing detailed model information.
Details
The function fits a harmonic regression model with 'nham' components to the input time series, optionally removing a linear trend and allowing for weighted estimation when standard errors are available.
References
Elorrieta F, Eyheramendy S, Palma W, Ojeda C (2021). “A novel bivariate autoregressive model for predicting and forecasting irregularly observed time series.” Monthly Notices of the Royal Astronomical Society, 505(1), 1105-1116. ISSN 0035-8711, doi:10.1093/mnras/stab1216 , https://academic.oup.com/mnras/article-pdf/505/1/1105/38391762/stab1216.pdf.