baysea: Bayesian Seasonal Adjustment Procedure

View source: R/timsac84.R

bayseaR Documentation

Bayesian Seasonal Adjustment Procedure

Description

Decompose a nonstationary time series into several possible components.

Usage

  baysea(y, period = 12, span = 4, shift = 1, forecast = 0, trend.order = 2,
         seasonal.order = 1, year = 0, month = 1, out = 0, rigid = 1,
         zersum = 1, delta = 7, alpha = 0.01, beta = 0.01, gamma = 0.1,
         spec = TRUE, plot = TRUE, separate.graphics = FALSE)

Arguments

y

a univariate time series.

period

number of seasonals within a period.

span

number of periods to be processed at one time.

shift

number of periods to be shifted to define the new span of data.

forecast

length of forecast at the end of data.

trend.order

order of differencing of trend.

seasonal.order

order of differencing of seasonal. seasonal.order is smaller than or equal to span.

year

trading-day adjustment option.

= 0 : without trading day adjustment
> 0 : with trading day adjustment
(the series is supposed to start at this year)
month

number of the month in which the series starts. If year=0 this parameter is ignored.

out

outlier correction option.

0 : without outlier detection
1 : with outlier detection by marginal probability
2 : with outlier detection by model selection
rigid

controls the rigidity of the seasonal component. more rigid seasonal with larger than rigid.

zersum

controls the sum of the seasonals within a period.

delta

controls the leap year effect.

alpha

controls prior variance of initial trend.

beta

controls prior variance of initial seasonal.

gamma

controls prior variance of initial sum of seasonal.

spec

logical. If TRUE (default), estimate spectra of irregular and differenced adjusted.

plot

logical. If TRUE (default), plot trend, adjust, smoothed, season and irregular.

separate.graphics

logical. If TRUE, a graphic device is opened for each graphics display.

Details

This function realized a decomposition of time series y into the form

y(t) = T(t) + S(t) + I(t) + TDC(t) + OCF(t)

where T(t) is trend component, S(t) is seasonal component, I(t) is irregular, TDC(t) is trading day factor and OCF(t) is outlier correction factor. For the purpose of comparison of models the criterion ABIC is defined

ABIC = -2 \log(maximum\ likelihood\ of\ the\ model).

Smaller value of ABIC represents better fit.

Value

outlier

outlier correction factor.

trend

trend.

season

seasonal.

tday

trading day component if year > 0.

irregular

= y - trend - season - tday - outlier.

adjust

= trend - irregular.

smoothed

= trend + season + tday.

aveABIC

averaged ABIC.

irregular.spec

a list with components acov (autocovariances), acor (normalized covariances), mean, v (innovation variance), aic (AIC), parcor (partial autocorrelation) and rspec (rational spectrum) of irregular if spec = TRUE.

adjusted.spec

a list with components acov, acor, mean, v, aic, parcor and rspec of differenced adjusted series if spec = TRUE.

differenced.trend

a list with components acov, acor, mean, v, aic and parcor of differenced trend series if spec = TRUE.

differenced.season

a list with components acov, acor, mean, v, aic and parcor of differenced seasonal series if spec = TRUE.

References

H.Akaike, T.Ozaki, M.Ishiguro, Y.Ogata, G.Kitagawa, Y-H.Tamura, E.Arahata, K.Katsura and Y.Tamura (1985) Computer Science Monograph, No.22, Timsac84 Part 1. The Institute of Statistical Mathematics.

Examples

data(LaborData)
baysea(LaborData, forecast = 12)

timsac documentation built on Sept. 30, 2023, 5:06 p.m.