EVOLUTION-MANAGER
Edit File: spectrum.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Spectral Density Estimation</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for spectrum {stats}"><tr><td>spectrum {stats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Spectral Density Estimation</h2> <h3>Description</h3> <p>The <code>spectrum</code> function estimates the spectral density of a time series. </p> <h3>Usage</h3> <pre> spectrum(x, ..., method = c("pgram", "ar")) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>A univariate or multivariate time series.</p> </td></tr> <tr valign="top"><td><code>method</code></td> <td> <p>String specifying the method used to estimate the spectral density. Allowed methods are <code>"pgram"</code> (the default) and <code>"ar"</code>. Can be abbreviated.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Further arguments to specific spec methods or <code>plot.spec</code>.</p> </td></tr> </table> <h3>Details</h3> <p><code>spectrum</code> is a wrapper function which calls the methods <code><a href="spec.pgram.html">spec.pgram</a></code> and <code><a href="spec.ar.html">spec.ar</a></code>. </p> <p>The spectrum here is defined with scaling <code>1/<a href="time.html">frequency</a>(x)</code>, following S-PLUS. This makes the spectral density a density over the range <code>(-frequency(x)/2, +frequency(x)/2]</code>, whereas a more common scaling is <i>2pi</i> and range <i>(-0.5, 0.5]</i> (e.g., Bloomfield) or 1 and range <i>(-pi, pi]</i>. </p> <p>If available, a confidence interval will be plotted by <code>plot.spec</code>: this is asymmetric, and the width of the centre mark indicates the equivalent bandwidth. </p> <h3>Value</h3> <p>An object of class <code>"spec"</code>, which is a list containing at least the following components: </p> <table summary="R valueblock"> <tr valign="top"><td><code>freq</code></td> <td> <p>vector of frequencies at which the spectral density is estimated. (Possibly approximate Fourier frequencies.) The units are the reciprocal of cycles per unit time (and not per observation spacing): see ‘Details’ below.</p> </td></tr> <tr valign="top"><td><code>spec</code></td> <td> <p>Vector (for univariate series) or matrix (for multivariate series) of estimates of the spectral density at frequencies corresponding to <code>freq</code>.</p> </td></tr> <tr valign="top"><td><code>coh</code></td> <td> <p><code>NULL</code> for univariate series. For multivariate time series, a matrix containing the <em>squared</em> coherency between different series. Column <i> i + (j - 1) * (j - 2)/2</i> of <code>coh</code> contains the squared coherency between columns <i>i</i> and <i>j</i> of <code>x</code>, where <i>i < j</i>.</p> </td></tr> <tr valign="top"><td><code>phase</code></td> <td> <p><code>NULL</code> for univariate series. For multivariate time series a matrix containing the cross-spectrum phase between different series. The format is the same as <code>coh</code>.</p> </td></tr> <tr valign="top"><td><code>series</code></td> <td> <p>The name of the time series.</p> </td></tr> <tr valign="top"><td><code>snames</code></td> <td> <p>For multivariate input, the names of the component series.</p> </td></tr> <tr valign="top"><td><code>method</code></td> <td> <p>The method used to calculate the spectrum.</p> </td></tr> </table> <p>The result is returned invisibly if <code>plot</code> is true. </p> <h3>Note</h3> <p>The default plot for objects of class <code>"spec"</code> is quite complex, including an error bar and default title, subtitle and axis labels. The defaults can all be overridden by supplying the appropriate graphical parameters. </p> <h3>Author(s)</h3> <p>Martyn Plummer, B.D. Ripley</p> <h3>References</h3> <p>Bloomfield, P. (1976) <em>Fourier Analysis of Time Series: An Introduction.</em> Wiley. </p> <p>Brockwell, P. J. and Davis, R. A. (1991) <em>Time Series: Theory and Methods.</em> Second edition. Springer. </p> <p>Venables, W. N. and Ripley, B. D. (2002) <em>Modern Applied Statistics with S-PLUS.</em> Fourth edition. Springer. (Especially pages 392–7.) </p> <h3>See Also</h3> <p><code><a href="spec.ar.html">spec.ar</a></code>, <code><a href="spec.pgram.html">spec.pgram</a></code>; <code><a href="plot.spec.html">plot.spec</a></code>. </p> <h3>Examples</h3> <pre> require(graphics) ## Examples from Venables & Ripley ## spec.pgram par(mfrow = c(2,2)) spectrum(lh) spectrum(lh, spans = 3) spectrum(lh, spans = c(3,3)) spectrum(lh, spans = c(3,5)) spectrum(ldeaths) spectrum(ldeaths, spans = c(3,3)) spectrum(ldeaths, spans = c(3,5)) spectrum(ldeaths, spans = c(5,7)) spectrum(ldeaths, spans = c(5,7), log = "dB", ci = 0.8) # for multivariate examples see the help for spec.pgram ## spec.ar spectrum(lh, method = "ar") spectrum(ldeaths, method = "ar") </pre> <hr /><div style="text-align: center;">[Package <em>stats</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>