Learn R Programming

timsac (version 1.3.0)

decomp: Time Series Decomposition (Seasonal Adjustment) by Square-Root Filter

Description

Decompose a nonstationary time series into several possible components by square-root filter.

Usage

decomp(y, trend.order=2, ar.order=2, frequency=12,
         seasonal.order=1, log=FALSE, trade=FALSE, diff=1,
         year=1980, month=1, miss=0, omax=99999.9, plot=TRUE)

Arguments

y
a univariate time series.
trend.order
trend order (0, 1, 2 or 3).
ar.order
AR order (less than 11, try 2 first).
frequency
number of seasons in one period.
seasonal.order
seasonal order (0, 1 or 2).
log
log transformation of data (if log = TRUE).
trade
trading day adjustment (if trade = TRUE).
diff
numerical differencing (1 sided or 2 sided).
year
the first year of the data.
month
the first month of the data.
miss
missing data flag. rl{ = 0 : no consideration > 0 : values which are greater than omax are treated as missing data < 0 : values which are less than omax are treated as missing data }
omax
maximum or minimum data value (if miss > 0 or miss < 0).
plot
logical. If TRUE (default) trend, seasonal, ar and trad are plotted.

Value

  • trendtrend component.
  • seasonalseasonal component.
  • arAR process.
  • tradtrading day factor.
  • noiseobservational noise.
  • aicAIC.
  • lkhdlikelihood.
  • sigma2sigma^2.
  • tau1system noise variances tau2(1).
  • tau2system noise variances tau2(2).
  • tau3system noise variances tau2(3).
  • arcoefvector of AR coefficients.
  • tdftrading day factor tdf(i) (i=1,7).

Details

The Basic Model $y(t) = T(t) + AR(t) + S(t) + TD(t) + W(t)$ where $T(t)$ is trend component, $AR(t)$ is AR process, $S(t)$ is seasonal component, $TD(t)$ is trading day factor and $W(t)$ is observational noise. Component Models Trend component (trend.order m1) $m1= 1 : T(t) = T(t-1) + V1(t)$ $m1= 2 : T(t) = 2T(t-1) - T(t-2) + V1(t)$ $m1= 3 : T(t) = 3T(t-1) -3T(t-2) + T(t-2) + V1(t)$ AR component (ar.order m2) $AR(t) = a(1)AR(t-1) + \ldots + a(m2)AR(t-m2) + V2(t)$ Seasonal component (seasonal.order k, frequency f) $k=1 : S(t) = -S(t-1) - \ldots - S(t-f+1) + V3(t)$ $k=2 : S(t) = -2S(t-1) - \ldots -f\ S(t-f+1) - \ldots - S(t-2f+2) + V3(t)$ Trading day effect $TD(t) = b(1) TRADE(t,1) + \ldots + b(7) TRADE(t,7)$ where $TRADE(t,i)$ is the number of $i$-th days of the week in $t$-th data and $b(1) + \ldots + b(7) = 0$.

References

G.Kitagawa (1981) A Nonstationary Time Series Model and Its Fitting by a Recursive Filter Journal of Time Series Analysis, Vol.2, 103-116. W.Gersch and G.Kitagawa (1983) The prediction of time series with Trends and Seasonalities Journal of Business and Economic Statistics, Vol.1, 253-264. G.Kitagawa (1984) A smoothness priors-state space modeling of Time Series with Trend and Seasonality Journal of American Statistical Association, VOL.79, NO.386, 378-389.

Examples

Run this code
data(Blsallfood)
  decomp(Blsallfood, trade=TRUE, year=1973)

Run the code above in your browser using DataLab