Title: | Complete Discrete Fourier Transform (DFT) and Periodogram |
---|---|
Description: | Calculate the predictive discrete Fourier transform, complete discrete Fourier transform, complete periodogram, and tapered complete periodogram. This algorithm is based on the preprint "Spectral methods for small sample time series: A complete periodogram approach" (2020) by Sourav Das, Suhasini Subba Rao, and Junho Yang. |
Authors: | Junho Yang |
Maintainer: | Junho Yang <[email protected]> |
License: | GPL-2 |
Version: | 0.1.2 |
Built: | 2024-12-17 06:38:36 UTC |
Source: | CRAN |
Function to calculate the complete periodogram.
complete.pgram(x, freq = 2 * pi * (1:length(x))/length(x), thres=NULL, ...)
complete.pgram(x, freq = 2 * pi * (1:length(x))/length(x), thres=NULL, ...)
x |
time series vector. |
freq |
frequency vector. |
thres |
(optional) positive threshold value. |
... |
Arguments used in the |
The default frequencies are 2*pi*(1:n)/n, where n is a length of a time series.
Real part of the complete periodogram vector.
Junho Yang
S. Das, S. Subba Rao, and J. Yang. Spectral methods for small sample time series: A complete periodogram approach. Submitted, 2020.
set.seed(123) x <- arima.sim(model=list(ar=0.7), n=100) v <- complete.pgram(x)
set.seed(123) x <- arima.sim(model=list(ar=0.7), n=100) v <- complete.pgram(x)
Function to calculate the complete DFT.
completeDFT(x, freq = 2 * pi * (1:length(x))/length(x), ...)
completeDFT(x, freq = 2 * pi * (1:length(x))/length(x), ...)
x |
time series vector. |
freq |
frequency vector. |
... |
Arguments used in the |
The default frequencies are 2*pi*(1:n)/n, where n is a length of a time series.
Complex valued complete DFT vector.
Junho Yang
S. Das, S. Subba Rao, and J. Yang. Spectral methods for small sample time series: A complete periodogram approach. Submitted, 2020.
set.seed(123) x <- arima.sim(model=list(ar=0.7), n=100) v <- completeDFT(x)
set.seed(123) x <- arima.sim(model=list(ar=0.7), n=100) v <- completeDFT(x)
Function to calculate the DFT of time series vector as in the reference.
fft2(x, freq = 2 * pi * (1:length(x))/length(x))
fft2(x, freq = 2 * pi * (1:length(x))/length(x))
x |
time series vector. |
freq |
frequency vector. |
sqrt(n) standardized. The default frequencies are 2*pi*(1:n)/n, where n is a length of a time series.
DFT vector.
Junho Yang
S. Das, S. Subba Rao, and J. Yang. Spectral methods for small sample time series: A complete periodogram approach. Submitted, 2020.
set.seed(123) x <- arima.sim(model=list(ar=0.7), n=100) v <- fft2(x)
set.seed(123) x <- arima.sim(model=list(ar=0.7), n=100) v <- fft2(x)
Function to calculate the predictive DFT.
predictiveDFT(x, freq = 2 * pi * (1:length(x))/length(x), taper = FALSE, ar = NULL, ...)
predictiveDFT(x, freq = 2 * pi * (1:length(x))/length(x), taper = FALSE, ar = NULL, ...)
x |
time series vector. |
freq |
frequency vector. |
taper |
logical vector. If TRUE, use the tapered time series to estimate an AR coefficients. Default is FALSE. |
ar |
predetermined AR coefficients to evaluate the predictive DFT. Default is NULL. |
... |
Arguments passing ar() function. |
If ar vector is predetermined, then we evaluate the predictive DFT using the this AR coefficient vector (see eq (2.2) of the reference). If ar is not specified (default), then we fit the best fitting AR(p) model using AIC and Yule-Walker estimator.
The complex valued predictive DFT vector.
Junho Yang
S. Das, S. Subba Rao, and J. Yang. Spectral methods for small sample time series: A complete periodogram approach. Submitted, 2020.
complete.pgram
, tapered.complete.pgram
set.seed(123) x <- arima.sim(model=list(ar=0.7), n=100) v1 <- predictiveDFT(x) #default v2 <- predictiveDFT(x,ar=c(0.7)) #predictive DFT using AR(1) model with coefficient: 0.7. v3 <- predictiveDFT(x,taper=TRUE) #Using tapered time series to fit the best AR model. v4 <- predictiveDFT(x, method="ols") #Using ols method to fit the best AR model.
set.seed(123) x <- arima.sim(model=list(ar=0.7), n=100) v1 <- predictiveDFT(x) #default v2 <- predictiveDFT(x,ar=c(0.7)) #predictive DFT using AR(1) model with coefficient: 0.7. v3 <- predictiveDFT(x,taper=TRUE) #Using tapered time series to fit the best AR model. v4 <- predictiveDFT(x, method="ols") #Using ols method to fit the best AR model.
Function to calculate the tapered DFT.
taperDFT(x, freq = 2 * pi * (1:length(x))/length(x), regularization.type = "1", p = 0.1)
taperDFT(x, freq = 2 * pi * (1:length(x))/length(x), regularization.type = "1", p = 0.1)
x |
time series vector. |
freq |
frequency vector. |
regularization.type |
character. if "1": sum of the taper equals to n, if "2": square sum of the taper equals to n. Default is "1". |
p |
proprotion of taper. |
Tapered DFT. The default taper is a Tukey's (or Cosine-bell) taper.
Complex valued tapered DFT vector.
Junho Yang.
set.seed(123) x <- arima.sim(model=list(ar=0.7), n=100) v <- taperDFT(x)
set.seed(123) x <- arima.sim(model=list(ar=0.7), n=100) v <- taperDFT(x)
Function to calculate the tapered complete periodogram.
tapered.complete.pgram(x, freq=2*pi*(1:length(x))/length(x), taperx=NULL, thres=NULL, ...)
tapered.complete.pgram(x, freq=2*pi*(1:length(x))/length(x), taperx=NULL, thres=NULL, ...)
x |
time series vector. |
freq |
frequency vector. |
taperx |
predetermined tapered DFT. If NULL, we use default settings of the taperedDFT function to calculate the tapered DFT. |
thres |
positive threshold value. |
... |
Arguments used in the |
The default frequencies are 2*pi*(1:n)/n, where n is a length of a time series.
Real part of the tapered complete periodogram vector.
Junho Yang
S. Das, S. Subba Rao, and J. Yang. Spectral methods for small sample time series: A complete periodogram approach. Submitted, 2020.
set.seed(123) x <- arima.sim(model=list(ar=0.7), n=100) v <- tapered.complete.pgram(x)
set.seed(123) x <- arima.sim(model=list(ar=0.7), n=100) v <- tapered.complete.pgram(x)