Decompose a time series into seasonal, trend and irregular components using the transform amplitude-frequency domain to time series.
descomponer(y,frequency,type)
a Vector of the observed time-serie values
Number of times in each unit time interval
lineal (1), quadratic(2)
The Vector of the observed time-serievalues
The trend and seasonal time serie of y
The trend time serie of y
The seasonal time serie of y
The remainder time serie of y
The regressors matrix use to the trend estimated
The regressors matrix use to the seasonal estimated
The coefficient vector use to the trend estimated
The coefficient vector use to the seasonal estimated
One could use a value of 7 for frequency when the data are sampled daily, and the natural time period is a week, or 4 and 12 when the data are sampled quarterly and monthly and the natural time period is a year.
Transforms the time series in amplitude-frequency domain, by a band spectrum regresion (Parra, F. ,2013) of the serie y_t and a OLS lineal trend, in which regression is carried out in the low and the sesaonal amplitude-frequency_t .The low frequency are the periodicity a n/2*frequency or (n-1)/2*frequency , if n is odd. The seasonal frequency are the periodicity: 2n/2*frequency,3n/2*frequency,4n/2*frequency,.. .
Use the "sort.data.frame" function, Kevin Wright (http://tolstoy.newcastle.edu.au/R/help/04/07/1076.html).
Slow computer in time series higher 1000 data.
The output is a data.frame object.
Harvey, A.C. (1978), Linear Regression in the Frequency Domain, International Economic Review, 19, 507-512.
Parra, F. (2014), Amplitude time-frequency regression, (http://econometria.wordpress.com/2013/08/21/estimation-of-time-varying-regression-coefficients/)
# NOT RUN {
data(ipi)
datos <- descomponer(ipi,12,2)
plot(ts(datos$datos,frequency=12))
# }
Run the code above in your browser using DataLab