\Header{spec.ar}{Estimate Spectral Density of a Time Series from AR Fit}
\keyword{ts}{spec.ar}
\begin{Description}\relax
Fits an AR model to \code{x} (or uses the existing fit) and computes
(and by default plots) the spectral density of the fitted model.\end{Description}
\begin{Usage}
\begin{verbatim}
spec.ar(x, n.freq, order = NULL, plot = TRUE, na.action,
        method = "yule-walker", ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] A univariate (not yet:or multivariate) time series or the
result of a fit by \code{\Link{ar}}.
\item[\code{n.freq}] The number of points at which to plot.
\item[\code{order}] The order of the AR model to be fitted.  If omitted,
the order is chosen by AIC.
\item[\code{plot}] Plot the periodogram?
\item[\code{na.action}] NA action function.
\item[\code{method}] \code{method} for \code{ar} fit.
\item[\code{...}] Graphical arguments passed to \code{\Link{plot.spec}}.
\end{ldescription}
\end{Arguments}
\begin{Value}
An object of class \code{\Link{spec}}.
The result is returned invisibly if \code{plot} is true.\end{Value}
\begin{Section}{Warning}
Some authors, for example Thomson (1990), warn strongly
that AR spectra can be misleading.\end{Section}
\begin{Note}\relax
The multivariate case is not yet implemented.\end{Note}
\begin{Author}\relax
B.D. Ripley\end{Author}
\begin{References}\relax
Thompson, D.J. (1990) Time series analysis of Holocene climate data.
\emph{Phil. Trans. Roy. Soc. A} \bold{330}, 601--616.

Venables, W.N. and Ripley, B.D. (1997) \emph{Modern Applied
Statistics with S-PLUS.} Second edition. Springer. (Especially
p. 448.)\end{References}
\begin{SeeAlso}\relax
\code{\Link{ar}}, \code{\Link{spectrum}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
data(lh)
spec.ar(lh)

data(UKLungDeaths)
spec.ar(ldeaths)
spec.ar(ldeaths, method="burg")
\end{ExampleCode}
\end{Examples}

