Learn R Programming

iNZightTS (version 1.5.7)

decompose: Decompose a time series object

Description

Decompose a time series object

Usage

decompose(
  obj,
  multiplicative = FALSE,
  t = 10,
  model.lim = NULL,
  data.name = NULL,
  ...
)

# S3 method for inzdecomp plot( x, recompose.progress = c(0, 0), recompose = any(recompose.progress > 0), ylab = x$currVar, xlab = "Date", title = NULL, xlim = c(NA, NA), colour = c("#1B9E46", "#45a8ff", "orangered"), ... )

Arguments

obj

an iNZightTS object

multiplicative

fit a multiplicative time series model?

t

the smoothing parameter

model.lim

limits for the time series model

data.name

the name of the data

...

additional arguments (ignored)

x

an inzdecomp object (from decompose(ts))

recompose.progress

if recompose is TRUE, this shows how much to show (for animation!). Length 2 numeric: the first is 0 for seasonal, and 1 for residual; second component is how many observations have been recomposed so far

recompose

logical as to whether the recomposition is shown or not

ylab

the label for the y axis

xlab

the label for the x axis

title

the title for the plot

xlim

the x axis limits

colour

vector of three colours for trend, seasonal, and residuals, respectively

Value

an inzdecomp object (this is the original object with an additional decompVars component)

Invisibly returns the original decomposition object. Mainly called to plot the decomposition.

Methods (by generic)

  • plot: Plot a time series decomposition

References

R. B. Cleveland, W. S. Cleveland, J.E. McRae, and I. Terpenning (1990) STL: A Seasonal-Trend Decomposition Procedure Based on Loess. Journal of Official Statistics, 6, 3iV73.

Examples

Run this code
# NOT RUN {
t <- iNZightTS(visitorsQ)
decomp.ts <- decompose(t, data.name = "Visitors")
plot(decomp.ts)

# }

Run the code above in your browser using DataLab