Learn R Programming

nse (version 1.21)

nse.geyer: Geyer estimator

Description

Function which calculates the numerical standard error with the method of Geyer (1992).

Usage

nse.geyer(
  x,
  type = c("iseq", "bm", "obm", "iseq.bm"),
  nbatch = 30,
  iseq.type = c("pos", "dec", "con")
)

Value

The NSE estimator.

Arguments

x

A numeric vector.

type

The type which can be either "iseq", "bm", "obm" or "iseq.bm". See *Details*. Default is type = "iseq".

nbatch

Number of batches when type = "bm" and type = "iseq.bm". Default is nbatch = 30.

iseq.type

Constraints on function: "pos" for nonnegative, "dec" for nonnegative and nonincreasing, and "con" for nonnegative, nonincreasing, and convex. Default is iseq.type = "pos".

Author

David Ardia and Keven Bluteau

Details

The type "iseq" gives the positive intial sequence estimator, "bm" is the batch mean estimator, "obm" is the overlapping batch mean estimator and "iseq.bm" is a combination of "iseq" and "bm".

References

Geyer, C.J. (1992). Practical Markov chain Monte Carlo. Statistical Science 7(4), .473-483.

Examples

Run this code
if (FALSE) {
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.geyer(x = x, type = "bm", nbatch = 30)
nse.geyer(x = x, type = "obm", nbatch = 30)
nse.geyer(x = x, type = "iseq", iseq.type = "pos")
nse.geyer(x = x, type = "iseq.bm", iseq.type = "con")
}

Run the code above in your browser using DataLab