descomponer {descomponer} | R Documentation |
Decompose a time series into seasonal, trend and irregular components using the transform amplitude-frequency domain to time series.
descomponer(y,frequency,type)
y |
a Vector of the observed time-serie values |
frequency |
Number of times in each unit time interval |
type |
lineal (1), quadratic(2) |
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.
y |
The Vector of the observed time-serievalues |
TDST |
The trend and seasonal time serie of y |
TD |
The trend time serie of y |
ST |
The seasonal time serie of y |
IR |
The remainder time serie of y |
regresoresTD |
The regressors matrix use to the trend estimated |
regresoresST |
The regressors matrix use to the seasonal estimated |
coeficientesTD |
The coefficient vector use to the trend estimated |
coeficientesSD |
The coefficient vector use to the seasonal estimated |
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/)
data(ipi)
datos <- descomponer(ipi,12,2)
plot(ts(datos$datos,frequency=12))