The periodogram is a classical tool
based on the sample Fourier transform
for finding periodic components in a time series.
The procedure 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,...)For any FFT index \(j\) (say where a strong peak occurs)
\(j\) corresponds to the number of cycles in the FFT window,
so the period can be easily computed as T_t = fftlen/j.
input time series, missing values denoted by NaNs will be
replaced in pgram by zeros.
length of FFT which will be used. In 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.
other arguments that are connected with periodogram plot: 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".
Harry Hurd
When we assume that period T_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).
Box, G. E. P., Jenkins, G. M., Reinsel, G. (1994), Time Series Analysis, 3rd Ed., Prentice-Hall,
Englewood Cliffs, NJ.
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