\Header{decompose}{Classical Seasonal Decomposition by Moving Averages}
\alias{plot.decomposed.ts}{decompose}
\keyword{ts}{decompose}
\begin{Description}\relax
Decompose a time series into seasonal, trend and irregular components
using moving averages.  Deals with additive or multiplicative
seasonal component.
\end{Description}
\begin{Usage}
\begin{verbatim}
decompose(x, type = c("additive", "multiplicative"), filter = NULL)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] A time series.
\item[\code{type}] The type of seasonal component.
\item[\code{filter}] A vector of filter coefficients in reverse time order (as for
AR or MA coefficients), used for filtering out the seasonal
component. If \code{NULL}, a moving average with symmetric window is
performed.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The additive model used is:

Y[t] = T[t] + S[t] + e[t]

The multiplicative model used is:

Y[t] = T[t] * S[t] + e[t]
\end{Details}
\begin{Value}
An object of class \code{"decomposed.ts"} with following components:
\begin{ldescription}
\item[\code{seasonal}] The seasonal component (i.e., the repeated seasonal figure)
\item[\code{figure}] The estimated seasonal figure only
\item[\code{trend}] The trend component
\item[\code{random}] The remainder part
\item[\code{type}] The value of \code{type}
\end{ldescription}
\end{Value}
\begin{Note}\relax
The function \code{\Link{stl}} provides a much more sophisticated
decomposition.
\end{Note}
\begin{Author}\relax
David Meyer \email{david.meyer@ci.tuwien.ac.at}
\end{Author}
\begin{SeeAlso}\relax
\code{\Link{stl}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
data(co2)
m <- decompose(co2)
m$figure
plot(m)
\end{ExampleCode}
\end{Examples}

