[R] Spectrum confidence interval

Uwe Ligges ligges at statistik.tu-dortmund.de
Sun Nov 29 17:50:25 CET 2009


Late answer, but maybe still helpful (if I am correct this question is 
still unanswered on R-help):



Clément Poirier wrote:
> Dear useRs,
> 
> I'd like to plot a confidence interval on a periodogram. My problem is 
> that spec.pgram(sunspots,ci=0.95,log="yes") gives me a blue error bar on 
> the plot, but spec.pgram(sunspots,ci=0.95,log="no") does not. My 
> questions are:
> 1. how should I plot the confidence interval with log="no"?

This is not supported in plot.spec (the plot method for spec objects), 
since handled in the else part after
   if (ci <= 0 || !is.numeric(x$df) || log == "no")



> 2. how should I get the min and max values of the confidence interval?

Type
  plot.spec

In the code for that function, you will find the function definition of 
spec.ci() which calculates the confidence intervals. Just define that 
function in your workspace and you can go on and add lines to your plot now.

Best wishes,
Uwe Ligges



> Many thanks for your help!
> Clement Poirier
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list