TSSS (version 1.3.4-5)

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 = NULL, tau2.ini = NULL, filter = c(1, length(y)),
       predict = length(y), arcoef.ini = NULL, log = FALSE, log.base = "e",
       minmax = c(-1.0e+30, 1.0e+30), plot = TRUE, ...)

Value

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

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 = TRUE).

noise

noise component.

cov

covariance matrix of smoother.

Arguments

y

a univariate time series with or without the tsp attribute.

trend.order

trend order (0, 1, 2 or 3).

seasonal.order

seasonal order (0, 1 or 2).

ar.order

AR order (0, 1, 2, 3, 4 or 5).

trade

logical; if TRUE, the model including trading day effect component is considered.

period

If the tsp attribute of y is NULL, valid number of seasons in one period in the case that seasonal.order > 0 and/or trade = TRUE.

4 :quarterly data
12 :monthly data
5 :daily data (5 days a week)
7 :daily data (7 days a week)
24 :hourly data

tau2.ini

initial estimate of variance of the system noise \(\tau^2\) less than 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.

log.base

the letter "e" (default) or "10" specifying the base of logarithmic transformation. Valid only if log = TRUE.

minmax

lower and upper limits of observations.

plot

logical. If TRUE (default), trend, seasonal, AR and noise components are plotted.

...

graphical arguments passed to plot.season.

References

Kitagawa, G. (2020) Introduction to Time Series Modeling with Applications in R. Chapman & Hall/CRC.

Examples

Run this code
# 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