R/segment.R

Defines functions segment

segment = function(Y, mean_y, k, n, p){
  b = rep(0, p^2)
  for (t in (1:(n-k))){
    s = 0
    C = Y[,(t+k)] - mean_y
    D = Y[, t] - mean_y
    for (i in (1:p)){
      for (j in (1:p)){
        s = s+1
        b[s] = b[s] + C[i]*D[j]
      }
    }
  }
  b = b/n
  return (b)
}

Try the HDtest package in your browser

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

HDtest documentation built on May 2, 2019, 11:53 a.m.