Rev 88598 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/stats/man/spec.ar.Rd% Part of the R package, https://www.R-project.org% Copyright 1995-2018 R Core Team% Distributed under GPL 2 or later\name{spec.ar}\alias{spec.ar}\title{Estimate Spectral Density of a Time Series from AR Fit}\usage{spec.ar(x, n.freq, order = NULL, plot = TRUE, na.action = na.fail,method = "yule-walker", \dots)}\arguments{\item{x}{A univariate (not yet:or multivariate) time series or theresult of a fit by \code{\link{ar}}.}\item{n.freq}{The number of points at which to plot.}\item{order}{The order of the AR model to be fitted. If omitted,the order is chosen by AIC.}\item{plot}{Plot the periodogram?}\item{na.action}{\code{NA} action function.}\item{method}{\code{method} for \code{\link{ar}} fit.}\item{\dots}{Graphical arguments passed to \code{\link{plot.spec}}.}}\description{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.}\value{An object of class \code{"spec"}.The result is returned invisibly if \code{plot} is true.}\section{Warning}{Some authors, for example \bibcitet{R:Thomson:1990}, warn stronglythat AR spectra can be misleading.}\references{\bibinfo{R:Venables+Ripley:2002}{footer}{(Especially page 402.)}\bibshow{*, R:Venables+Ripley:2002}}\seealso{\code{\link{ar}}, \code{\link{spectrum}}.}\note{The multivariate case is not yet implemented.}\examples{require(graphics)spec.ar(lh)spec.ar(ldeaths)spec.ar(ldeaths, method = "burg")spec.ar(log(lynx))spec.ar(log(lynx), method = "burg", add = TRUE, col = "purple")spec.ar(log(lynx), method = "mle", add = TRUE, col = "forest green")spec.ar(log(lynx), method = "ols", add = TRUE, col = "blue")}\keyword{ts}