spec.pgram(bats)R Documentation

Estimate spectral density of a time series from smoothed periodogram

Description

spec.pgram calculates the periodogram using a fast Fourier transform, and optionally smooths the result with a series of modified Daniell smoothers (moving averages giving half weight to the end values).

Usage

spec.pgram(x, spans=1, taper=0.1, demean=FALSE, detrend=TRUE,
	pad=0, plot=FALSE)

Arguments

x A time series.
spans Vector of odd integers giving the widths of modified Daniell smoothers to be used to smooth the periodogram.
taper Proportion of data to taper. A split cosine bell taper is applied to this proportion of the data at the beginning and end of the series.
demean logical. If TRUE, subtract the mean of the series.
detrend logical. If TRUE, remove a linear trend from the series. This will also remove the mean.
pad Proportion of data to pad. Zeros are added to the end of the series to increase its length by the proportion pad.
plot Plot the periodogram.

Details

The raw periodogram is not a consistent estimator of the spectral density, but adjacent values are asymptotically independent. Hence a consistent estimator can be derived by smoothing the raw periodogram, assuming that the spectral density is smooth.

Value

An object of class spec with the following additional list elements.
spans The spans argument. Values which are not odd integers are converted to the next highest odd integer.
filter The convolution of the modified Daniell smoothers which is used to smooth the raw periodogram.
df The distribution of the spectral density estimate can be approximated by a chi square distribution with df degrees of freedom.
bandwidth
taper The value of the taper argument
pad The value of the pad argument
detrend The value of the detrend argument
demean The value of the demean argument

Note

The series will be automatically padded with zeros until the series length is a highly composite number in order to help the Fast Fourier Transform. This is done automatically and is not controlled by the pad argument.

Author(s)

Martyn Plummer

See Also

spectrum,plot.spec, fft


[Package Contents]