Displaying 1 result from an estimated 1 matches for "matrec".
Did you mean:
marec
2011 Nov 27
1
generating a vector of y_t = \sum_{i = 1}^t (alpha^i * x_{t - i + 1})
...") , sep = ","),
collapse = ","), ")", sep = ""))), nc = n, byrow = TRUE)
colSums(up.mat * exp.mat)
}
vecRec(c(1, 2, 3), 0.5)
## Sweep is slow, shouldn't use it.
matRec <- function(x, alpha){
n <- length(x)
exp.mat <- matrix(rep(x, each = n), nc = n, byrow = TRUE)
up.mat <- sweep(matrix(cumprod(rep(alpha, n)), nc = n, nr = n,
byrow = TRUE), 1,
c(1, cumprod(rep(1/alpha, n - 1...