R/estimateResidual.R

"estimateResidual" <-
  function(Y,h = 10) {
    n <- length(Y)
    YBar <- rep(0,n)
    for (i in 1:n) {
      a <- min(n,i+h)
      b <- max(1,i-h)
      YBar[i] <- mean(Y[b:a])
    }
    return(Y-YBar)
  }

Try the bwd package in your browser

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

bwd documentation built on May 2, 2019, 6:45 a.m.