Learn R Programming

perARMA (version 1.3)

pgram: Plotting the periodogram of time series

Description

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.

Usage

pgram(x, fftlen,...)

Arguments

x
input time series, missing values denoted by NaNs will be replaced in pgram by zeros.
fftlen
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,
...
other arguments that are connected with periodogram plot: np1, np2, halflen, alpha, rejalpha, logsw, datastr, typeci, typepgram, c

Value

  • 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 = fftlen/j.

Details

When we assume that period 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).

References

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.

See Also

scoh

Examples

Run this code
data(volumes)
dev.set(which=1)
pgram(t(volumes),length(volumes),datastr='volumes')

Run the code above in your browser using DataLab