harmonicfit: Harmonic Fit to Time Series

harmonicfitR Documentation

Harmonic Fit to Time Series

Description

This function fit an k-harmonic function to time series data.

Usage

harmonicfit(
  file,
  f1,
  nham = 4,
  weights = NULL,
  print = FALSE,
  remove_trend = TRUE
)

Arguments

file

A matrix with two columns. The first column corresponds to the observations times, and the second column corresponds to the measures.

f1

Frequency (1/Period) of the time series

nham

Number of harmonic components in the model

weights

An array with the weights of each observation

print

logical; if true, the summary of the harmonic fitted model will be printed. The default value is false.

remove_trend

logical; if true, the linear trend of time series will be removed before the the harmonic model is fitted.

Value

A list with the following components:

  • res Residuals to the harmonic fit of the time series.

  • t Observations times.

  • R2 Adjusted R-Squared.

  • MSE Mean Squared Error.

  • coef Summary of the coefficients estimated by the harmonic model.

Examples

data(clcep)
f1=0.060033386
results=harmonicfit(file=clcep[,1:2],f1=f1)
results$R2
results$MSE
results=harmonicfit(file=clcep[,1:2],f1=f1,nham=3)
results$R2
results$MSE
results=harmonicfit(file=clcep[,1:2],f1=f1,weights=clcep[,3])
results$R2
results$MSE

iAR documentation built on Nov. 25, 2022, 1:06 a.m.

Related to harmonicfit in iAR...