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)
    return(lagmat)
}

Try the DBfit package in your browser

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

DBfit documentation built on May 1, 2021, 1:09 a.m.