pgram computes and plots an average
of $np$ periodograms where np=floor(length(x)/fftlen) where the
input parameter fftlen is the length of the FFT; to get just
1 FFT of length fftlen, use x(1:fftlen) in place of x. To get a
significance of high periodogram peaks, the procedure tests,
at each frequency, the value of the averaged periodogram against
the average of 2*halflen neighboring cells (halflen on each side),
and averaged over the $np$ periodograms; the neighboring cell average
is called the background. Significance of the ratio of center
frequency average to the background average is computed from the
F distribution.
pgram(x, fftlen,...)pgram by zeros.
pgram we can specify the desired length of the FFT, then x is divided into pieces of
this length. FFT is done on each of these pieces and the resulting magnitude squares values are added,
so average of the periodograms for each frequency is obtained.
np1, np2, halflen, alpha, rejalpha, logsw,
datastr, typeci, typepgram, colci, colpgram, where
np1 and np2 are frequency indexes of the first and the last frequency in the periodogram plot; it is required that
$np1 > halflen$ and usually $np2=\left \lfloor length(x)/2 \right \rfloor$, because periodogram is symmetric;
halflen is a value on each side of the center for background estimation,
alpha is significance level for testing for periodic components,
rejalpha is significance level for rejecting outliers in the background estimation,
logsw if is equal to 1 plot of the periodogram is in $\log$ scale, else linear,
datastr string name of data for printing,
Parameters typeci / typepgram, colci / colpgram define the type and colors of confidence intervals / periodogram values on the plot.
By default they are fixed to np1 = 5, np2 = fftlen/2, halflen = 4, alpha = .05, rejalpha = .01, logsw = 1,
datastr = 'data', typeci = "b", typepgram = "b", colci = "red", colpgram = "blue".
T = fftlen/j.
T of PC-T structure is unknown,
function pgram enables us to find
candidate for the period length assuming the period of
the second order structure is the same as the period of
the first order structure (IE, in the series itself).
Hurd, H. L., Miamee, A. G., (2007), Periodically Correlated Random Sequences: Spectral Theory and Practice, Wiley InterScience.
scoh
data(volumes)
dev.set(which=1)
pgram(t(volumes),length(volumes),datastr='volumes')
Run the code above in your browser using DataLab