Type: | Package |
Title: | Complete Discrete Fourier Transform (DFT) and Periodogram |
Version: | 0.1.2 |
Date: | 2020-06-29 |
Author: | Junho Yang |
Maintainer: | Junho Yang <junhoyang@stat.tamu.edu> |
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. |
License: | GPL-2 |
NeedsCompilation: | no |
Packaged: | 2020-06-29 14:39:12 UTC; junhoyang |
Repository: | CRAN |
Date/Publication: | 2020-06-29 15:30:17 UTC |
Complete Periodogram
Description
Function to calculate the complete periodogram.
Usage
complete.pgram(x, freq = 2 * pi * (1:length(x))/length(x), thres=NULL, ...)
Arguments
x |
time series vector. |
freq |
frequency vector. |
thres |
(optional) positive threshold value. |
... |
Arguments used in the |
Details
The default frequencies are 2*pi*(1:n)/n, where n is a length of a time series.
Value
Real part of the complete periodogram vector.
Author(s)
Junho Yang
References
S. Das, S. Subba Rao, and J. Yang. Spectral methods for small sample time series: A complete periodogram approach. Submitted, 2020.
See Also
Examples
set.seed(123)
x <- arima.sim(model=list(ar=0.7), n=100)
v <- complete.pgram(x)
Complete DFT
Description
Function to calculate the complete DFT.
Usage
completeDFT(x, freq = 2 * pi * (1:length(x))/length(x), ...)
Arguments
x |
time series vector. |
freq |
frequency vector. |
... |
Arguments used in the |
Details
The default frequencies are 2*pi*(1:n)/n, where n is a length of a time series.
Value
Complex valued complete DFT vector.
Author(s)
Junho Yang
References
S. Das, S. Subba Rao, and J. Yang. Spectral methods for small sample time series: A complete periodogram approach. Submitted, 2020.
See Also
Examples
set.seed(123)
x <- arima.sim(model=list(ar=0.7), n=100)
v <- completeDFT(x)
A new DFT function
Description
Function to calculate the DFT of time series vector as in the reference.
Usage
fft2(x, freq = 2 * pi * (1:length(x))/length(x))
Arguments
x |
time series vector. |
freq |
frequency vector. |
Details
sqrt(n) standardized. The default frequencies are 2*pi*(1:n)/n, where n is a length of a time series.
Value
DFT vector.
Author(s)
Junho Yang
References
S. Das, S. Subba Rao, and J. Yang. Spectral methods for small sample time series: A complete periodogram approach. Submitted, 2020.
See Also
Examples
set.seed(123)
x <- arima.sim(model=list(ar=0.7), n=100)
v <- fft2(x)
Predictive DFT.
Description
Function to calculate the predictive DFT.
Usage
predictiveDFT(x, freq = 2 * pi * (1:length(x))/length(x), taper = FALSE, ar = NULL, ...)
Arguments
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. |
Details
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.
Value
The complex valued predictive DFT vector.
Author(s)
Junho Yang
References
S. Das, S. Subba Rao, and J. Yang. Spectral methods for small sample time series: A complete periodogram approach. Submitted, 2020.
See Also
complete.pgram
, tapered.complete.pgram
Examples
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.
Tapered DFT
Description
Function to calculate the tapered DFT.
Usage
taperDFT(x, freq = 2 * pi * (1:length(x))/length(x), regularization.type = "1", p = 0.1)
Arguments
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. |
Details
Tapered DFT. The default taper is a Tukey's (or Cosine-bell) taper.
Value
Complex valued tapered DFT vector.
Author(s)
Junho Yang.
See Also
Examples
set.seed(123)
x <- arima.sim(model=list(ar=0.7), n=100)
v <- taperDFT(x)
Tapered Complete Periodogram
Description
Function to calculate the tapered complete periodogram.
Usage
tapered.complete.pgram(x, freq=2*pi*(1:length(x))/length(x), taperx=NULL, thres=NULL, ...)
Arguments
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 |
Details
The default frequencies are 2*pi*(1:n)/n, where n is a length of a time series.
Value
Real part of the tapered complete periodogram vector.
Author(s)
Junho Yang
References
S. Das, S. Subba Rao, and J. Yang. Spectral methods for small sample time series: A complete periodogram approach. Submitted, 2020.
See Also
Examples
set.seed(123)
x <- arima.sim(model=list(ar=0.7), n=100)
v <- tapered.complete.pgram(x)