File: lagIts.R

package info (click to toggle)
its 1.1.8-5
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 200 kB
  • sloc: makefile: 1
file content (12 lines) | stat: -rw-r--r-- 419 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
#lagIts-function----------------------------------------------------
lagIts <- function(x,k=1)
    {
    if (!inherits(x, "its")) stop("function is only valid for objects of class 'its'")
    lagmat <- x*NA
    dimnames(lagmat)[[2]] <- paste(dimnames(lagmat)[[2]],"lag",k)
    n <- dim(x)[1]
    if(k>0)
        {lagmat[(k+1):n,] <- x[1:(n-k),]}  else
        {lagmat[1:(n+k),] <- x[(1-k):n,]}
    return(lagmat)
    }