\HeaderA{tsdiag}{Diagnostic Plots for Time-Series Fits}{tsdiag}
\methaliasA{tsdiag.Arima}{tsdiag}{tsdiag.Arima}
\methaliasA{tsdiag.arima0}{tsdiag}{tsdiag.arima0}
\methaliasA{tsdiag.StructTS}{tsdiag}{tsdiag.StructTS}
\keyword{ts}{tsdiag}
\begin{Description}\relax
A generic function to plot time-series diagnostics.
\end{Description}
\begin{Usage}
\begin{verbatim}
tsdiag(object, gof.lag, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] a fitted time-series model
\item[\code{gof.lag}] the maximum number of lags for a Portmanteau
goodness-of-fit test
\item[\code{...}] further arguments to be passed to particular methods
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This is a generic function. It will generally plot the residuals,
often standardized, the autocorrelation function of the residuals, and
the p-values of a Portmanteau test for all lags up to \code{gof.lag}.

The methods for \code{\LinkA{arima}{arima}} and \code{\LinkA{StructTS}{StructTS}} objects
plots residuals scaled by the estimate of their (individual) variance,
and use the Ljung--Box version of the portmanteau test.
\end{Details}
\begin{Value}
None. Diagnostics are plotted.
\end{Value}
\begin{SeeAlso}\relax
\code{\LinkA{arima}{arima}}, \code{\LinkA{StructTS}{StructTS}}, \code{\LinkA{Box.test}{Box.test}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## Not run: require(graphics)

fit <- arima(lh, c(1,0,0))
tsdiag(fit)

## see also examples(arima)

(fit <- StructTS(log10(JohnsonJohnson), type="BSM"))
tsdiag(fit)
## End(Not run)\end{ExampleCode}
\end{Examples}

