[R] time series-V+R

Martyn Plummer plummer at iarc.fr
Tue Nov 6 18:40:00 CET 2001

On 06-Nov-2001 Brian Scholl wrote:
> I tried to follow the code in Venables + Ripley
> regarding time series.  When I compute the
> periodogram, no confidence intervals are spit out as
> per the book, and none are drawn on the figure.

It works for me.  It is true that the confidence interval
is not printed alongside the bandwidth on the bottom
of the plot in the R version.  However, an error bar is
plotted (in blue) in the top right hand corner of the graph.
If this doesn't appear, then you need to give a more specific

> Actually, I don't even really understand what the
> intervals printed in the book relate to, the interval
> ranges should be different at different cycles.

The confidence intervals are relative intervals.
To get a confidence interval for a particular frequency
then you must add the spectral density estimate (in
decibels) at that frequency.  If you don't believe that
then you need to consult a book on time series. Follow
the references in help(spectrum).

> How do
> I get them on the graph, and also get the values as a
> series.

The function that calculates the confidence intervals
is spec.ci() which is defined inside plot.spec(). You
can copy and paste it and use it on the output from

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list