R/kerMat.R

Defines functions kerMat

Documented in kerMat

kerMat <- function(p) {

  A <- matrix(0,p,p)
  p2 <- p^2
  for (i in 1:p) {
    for (j in 1:i) {
      norm2 <- (i-p)^2+(j-p)^2
      if (norm2 < p2) {
        A[i,j] <- A[j,i] <- .75*( 1 - norm2/p2 ) # Epanechnikov quadratic kernel
      }
    }
  }
  B <- rbind(A,apply(A,2,rev)[-1,])

  cbind(B,t(apply(B,1,rev))[,-1])

}

Try the spc4sts package in your browser

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

spc4sts documentation built on May 24, 2022, 5:07 p.m.