[R] cpgram: access data, confidence bands
Henri Mone
henriMone at gmail.com
Mon Nov 22 10:54:21 CET 2010
Dear R experts, beginners and everyone else,
I'm calculating "cumulative periodogram" using the command "cpgram"
[1] from the MASS library. Here is a short example with the "lh"
(hormone level) dataset:
library(MASS)
plot(lh,type="l",ylab="value",xlab="time", main="Hormone Levels (lh)")
spectrum(lh, main="Hormone Levels (lh)") # periodigram
cpgram(lh, main="Hormone Levels (lh)") # cumul. periodigram
I got following two questions:
1. The command "cpgram" plots the cumulative periodogram without any
problem. But I could not figure out any way to access the data of the
plot (save it in a variable).
the following command fails (contains no data):
>myObject<-cpgram(lh, main="Hormone Levels (lh)")
>summary(myObject)
Length Class Mode
0 NULL NULL
Is there an easy way to access the data of the cumulative
periodogram, or do I need to rewrite the "cpgram" function?
2. The "cpgram" function plots with the default options the 95%
confidence bands in the plot. The confidence band are defined such
that in 95% of the cases the true value will lie inside the bands. For
most cases which I tested the cumulative periodogram is outside the
confidence band. Does "cpgram" plot the confidence band of the the
cumulative periodogram or for the periodogram (I think it is the
cumulative periodigram, is this correct?). How should the confidence
band in "cpgram" be interpreted? Some more description on this would
be great.
Thanks,
Henri
1: http://svn.r-project.org/R/trunk/src/library/stats/R/cpgram.R
More information about the R-help
mailing list