R/lagmat.R

lagmat <-
function (x, p) 
{
    n <- length(x)
    xmat <- matrix(ncol = p, nrow = n - p)
    resp <- x[(p + 1):n]
    for (j in 1:p) {
        xmat[, j] <- x[(p - j + 1):(n - j)]
    }
    lagmat <- cbind(resp, xmat)
}
kloke/npsmReg2 documentation built on May 20, 2019, 12:34 p.m.