Function which calculates the numerical standard error with the spectrum at zero estimator.
nse.spec0( x, type = c("ar", "glm", "daniell", "modified.daniell", "tukey-hanning", "parzen", "triweight", "bartlett-priestley", "triangular", "qs"), lag.prewhite = 0, welch = FALSE, steep = FALSE )
A numeric vector.
Method to use in estimating the spectral density function, among
Prewhite the series before analysis (integer or
Use Welch's method (Welsh, 1967) to estimate the spectral density.
Use steep or sharp version of the kernel (Phillips et al., 2006) (only available for type:
Welsh's method use 50% overlap and 8 sub-samples.
"ar" estimates the spectral density using an autoregressive model,
"glm" using a generalized linear model Heidelberger & Welch (1981),
"daniell" uses daniell window from the R kernel function,
"modified.daniell" uses daniell window the R kernel function,
"tukey-hanning" uses the tukey-hanning window,
"parzen" uses the parzen window,
"triweight" uses the triweight window,
"bartlett-priestley" uses the Bartlett-Priestley window,
"triangular" uses the triangular window, and
"qs" uses the quadratic-spectral window,
This kernel based variance estimator apply weights to smooth out the spectral density using a kernel and takes the spectral density at frequency zero which is equivalent to the variance of the serie. Bandwidth for the kernel is automatically selected using cross-validatory methods (Hurvich, 1985).
The NSE estimator.
nse.spec0 relies on the packages
coda; see the documentation of this package for more details.
David Ardia and Keven Bluteau
Heidelberger, P., Welch, Peter D. (1981). A spectral method for confidence interval generation and run length control in simulations. Communications of the ACM 24(4), 233-245.
Phillips, P. C., Sun, Y., & Jin, S. (2006). Spectral density estimation and robust hypothesis testing using steep origin kernels without truncation. International Economic Review, 47(3), 837-894.
Welch, P. D. (1967), The use of Fast Fourier Transform for the estimation of power spectra: A method based on time averaging over short, modified periodograms. IEEE Transactions on Audio and Electroacoustics, AU-15(2): 70-73,
Hurvich, C. M. (1985). Data-driven choice of a spectrum estimate: extending the applicability of cross-validation methods. Journal of the American Statistical Association, 80(392), 933-940.
## Not run: n = 1000 ar = 0.9 mean = 1 sd = 1 set.seed(1234) x = c(arima.sim(n = n, list(ar = ar), sd = sd) + mean) nse.spec0(x = x, type = "parzen", lag.prewhite = 0, welch = TRUE, steep = TRUE) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.