exponentialFilter <- function (bDat, alpha=.5,meanInnovation=0) { ## Assumes that the est field of bData contains an array of ## estimates for all the time points so far. This function ## estimates the next row. icycle <- lastEstimate(bDat) obs <- bDat@obs[,,icycle+1] if (icycle == 0) { return (obs) } est <- bDat@est[,,icycle] alpha*obs + (1-alpha)*sweep(est,2,meanInnovation,"+") } meanPlusPolicy <- function (estimate,lead=.25) { mest <- apply(estimate,1,mean) mest+lead }