Periodogram {ptest}R Documentation

Periodogram

Description

Periodogram computation at Fourier or non-Fourier frequencies. When UseC=TRUE, a direct algorithm is used and non-Fourier frequencies are allowed as well as missing values. Missing values are indicated by NA in the input series z. When UseC=FALSE, the FFT is used. With the FFT, no missing values are allowed and the periodogram is obtained only at the Fourier frequencies, (1:[n/2])/n.

Usage

Periodogram(z, m = "default", UseC = TRUE, plot = FALSE)

Arguments

z time series, missing values indicated by NA
m number of
UseC UseC=TRUE, use compiled code, other the R funciton fft is used
plot If plot=TRUE, a plot of the periodogra is produced instead of the table

Details

A recursive algorithm is used to compute the necessary sine and cosine functions.

Value

returns matrix with 2 columns corresponding to frequency and periodogram value.

Author(s)

A.I. McLeod

See Also

fft, spectrum

Examples

#Compute the periodogram using 3 different algorithm and check accuracy.
#The absolute sum of the differences should be very small.
#First using fft method in R
out1<-Periodogram(sunspot.year, UseC=FALSE)
#Second using compiled code for the non-Fourier case
out2<-Periodogram(sunspot.year)
sum(abs(out1[,2]-out2[,2]))
#Third using compiled code for the non-Fourier case
out3<-Periodogram(sunspot.year, m=144)
sum(abs(out1[,2]-out3[,2]))

[Package ptest version 1.01 Index]