nse.spec0: The spectral density at zero.

Description Usage Arguments Details Value References Examples

Description

Calculate the variance of the mean with the spectrum at zero estimator.

Usage

1
2
nse.spec0(x, type = c("ar", "glm", "wosa", "bartlett", "tukey"),
  lag.prewhite = 0)

Arguments

x

A numeric vector.

type

A character string denoting the method to use in estimating the spectral density function

lag.prewhite

Prewhite the serie before analysis (integer or NULL, i.e. automatic selection)

Details

This is a wrapper around spectrum0.ar from the CODA package and mcsefrom the mcmcse package.

Value

The variance estimator.

References

Plummer, Martyn, et al. "CODA: Convergence diagnosis and output analysis for MCMC." R news 6.1 (2006): 7-11.

D.B. Percival and A. Walden "Spectral Analysis for Physical Applications: Multitaper and Conventional Univariate Techniques". Cambridge University Press (1993).

Barbour, A. J. and R. L. Parker (2014), "psd: Adaptive, sine multitaper power spectral density estimation for R", Computers & Geosciences Volume 63 February 2014 : 1-8

James M. Flegal, John Hughes and Dootika Vats. (17-08-2015). mcmcse: Monte Carlo Standard Errors for MCMC. R package version 1.1-2. Riverside, CA and Minneapolis, MN.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
n    = 1000
ar   = 0.9
mean = 1
sd   = 1
set.seed(1234)   
x = as.vector(arima.sim(n = n, list(ar = ar), sd = sd) + mean)
 
nse.spec0(x = x, type = "ar", lag.prewhite = 0)
nse.spec0(x = x, type = "ar", lag.prewhite = 1)
nse.spec0(x = x, type = "ar", lag.prewhite = NULL)

nse.spec0(x = x, type = "glm", lag.prewhite = 0)
nse.spec0(x = x, type = "glm", lag.prewhite = 1)
nse.spec0(x = x, type = "glm", lag.prewhite = NULL)

nse.spec0(x = x, type = "wosa", lag.prewhite = 0)
nse.spec0(x = x, type = "wosa", lag.prewhite = 1)
nse.spec0(x = x, type = "wosa", lag.prewhite = NULL)

nse.spec0(x = x, type = "bartlett", lag.prewhite = 0)
nse.spec0(x = x, type = "bartlett", lag.prewhite = 1)
nse.spec0(x = x, type = "bartlett", lag.prewhite = NULL)

nse.spec0(x = x, type = "tukey", lag.prewhite = 0)
nse.spec0(x = x, type = "tukey", lag.prewhite = 1)
nse.spec0(x = x, type = "tukey", lag.prewhite = NULL)
 

braverock/nse documentation built on May 13, 2019, 5:03 a.m.