\HeaderA{decompose}{Classical Seasonal Decomposition by Moving Averages}{decompose}
\aliasA{plot.decomposed.ts}{decompose}{plot.decomposed.ts}
\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{\LinkA{stl}{stl}} provides a much more sophisticated
decomposition.
\end{Note}
\begin{Author}\relax
David Meyer \email{David.Meyer@wu-wien.ac.at}
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{stl}{stl}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
require(graphics)

m <- decompose(co2)
m$figure
plot(m)
\end{ExampleCode}
\end{Examples}

