Learn R Programming

TSSS (version 1.2.3)

season: Seasonal Adjustment

Description

Seasonal adjustment by state space modeling.

Usage

season(y, trend.order = 1, seasonal.order = 1, ar.order = 0, trade = FALSE,
       period = 12, tau2.ini = NULL, filter = c(1, length(y)),
       predict = length(y), arcoef.ini = NULL, log = FALSE,
       minmax = c(-1.0e+30, 1.0e+30), plot = TRUE, ...)

Arguments

y

a univariate time series.

trend.order

trend order.

seasonal.order

seasonal order.

ar.order

AR order.

trade

logical; if TRUE, the model including trading day effect component is considered, where tsp(y) is not NULL and frequency(y) is 4 or 12.

period

number of seasons in one period. If the tsp attribute of y is not NULL, frequency(y).

= 12 : for monthly data = 12 : for monthly data
tau2.ini

initial estimate of variance of the system noise \(\tau^2\), not equal to 1.

filter

a numerical vector of the form c(x1,x2) which gives start and end position of filtering.

predict

the end position of prediction (\(\geq\) x2).

arcoef.ini

initial estimate of AR coefficients (for ar.order > 0).

log

logical. If TRUE, the data y is log-transformed.

minmax

lower and upper limits of observations.

plot

logical. If TRUE (default), 'trend', 'seasonal' and 'ar' are plotted.

…

further arguments to be passed to plot.season.

Value

An object of class "season", which is a list with the following elements:

tau2

variance of the system noise.

sigma2

variance of the observational noise.

llkhood

log-likelihood of the model.

aic

AIC of the model.

trend

trend component (for trend.order > 0).

seasonal

seasonal component (for seasonal.order > 0).

arcoef

AR coefficients (for ar.order > 0).

ar

AR component (for ar.order > 0).

day.effect

trading day effect (for trade = 6).

noise

noise component.

cov

covariance matrix of smoother.

References

Kitagawa, G. (2010) Introduction to Time Series Modeling. Chapman & Hall/CRC.

Examples

Run this code
# NOT RUN {
# BLSALLFOOD data
data(BLSALLFOOD)
season(BLSALLFOOD, trend.order = 2, seasonal.order = 1, ar.order = 2)

season(BLSALLFOOD, trend.order = 2, seasonal.order = 1, ar.order = 2,
       filter = c(1, 132))

# Wholesale hardware data
data(WHARD)
season(WHARD, trend.order = 2, seasonal.order = 1, ar.order = 0, trade = TRUE,
       log = TRUE)

season(WHARD, trend.order = 2, seasonal.order = 1, ar.order = 0, trade = TRUE,
       filter = c(1, 132), log = TRUE)
# }

Run the code above in your browser using DataLab