R/ESS.R

Defines functions ESS

Documented in ESS

ESS <-
function(trace, tol = 1e-8, BIC=TRUE, digits=2){
  if (NCOL(trace) > 1){ 
    cat('\nUnivariate Input Only \n')
    stop('see Examples in help(ESS) for multivariate case')
  }
  v = spec.ic(trace, BIC=BIC, order.max=30, plot=FALSE)
  spec0 = as.numeric(v[[2]][1,2])
  if (spec0 <= tol){
    return(0) 
  } else {
    return(round(length(trace)*var(trace)/spec0, digits))
 }
}

Try the astsa package in your browser

Any scripts or data that you put into this service are public.

astsa documentation built on Aug. 21, 2025, 5:47 p.m.