ESS | R Documentation |
Estimates the ESS of a given vector of samples.
ESS(trace, tol = 1e-08, BIC = TRUE, digits=2)
trace |
vector of sampled values from an MCMC run (univariate only) |
tol |
ESS is returned as zero if the estimated spectrum at frequency zero is less than this value |
BIC |
if TRUE (default), |
digits |
integer indicating the approximate number of decimal places to be used |
Uses spec.ic
to estimate the spectrum of the input at frequency zero (spec0
). Then, ESS is estimated as ESS = length(trace)*var(trace)/spec0
. See Examples for multivariate case.
ESS is discussed in detail in Example 6.31 of Time Series Analysis and Its Applications: With R Examples (5th ed, 2025).
Returns the estimated ESS of the input.
D.S. Stoffer
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/blob/master/NEWS.md.
The webpages for the texts and some help on using R for time series analysis can be found at https://nickpoison.github.io/.
# How autocorrelation affects ESS
x = matrix(NA, 500, 3) # sample size is 500
phi = c(0,.3,.9) # no, low, high
for (i in 1:3) x[,i] = sarima.sim(ar=phi[i])
apply(x, 2, ESS, digits=-1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.