set.seed(123)
d <- 6
myCov1 <- covTP(d = d, cov = "corr")
coef(myCov1) <- as.vector(simulPar(myCov1, nsim = 1))
as.list(myCov1)
## more examples and check the value of a 'covMat'
L <- list()
myCov <- list()
myCov[[1]] <- covTP(d = d, cov = "corr")
coef(myCov[[1]]) <- as.vector(simulPar(myCov[[1]], nsim = 1))
L[[1]] <- as.list(myCov[[1]])
myCov[[2]] <- covTP(k1Fun1 = k1Fun1PowExp, d = d, cov = "corr")
coef(myCov[[2]]) <- as.vector(simulPar(myCov[[2]], nsim = 1))
L[[2]] <- as.list(myCov[[2]])
myCov[[3]] <- covTP(k1Fun1 = k1Fun1PowExp, d = d, iso1 = 0L, cov = "corr")
coef(myCov[[3]]) <- as.vector(simulPar(myCov[[3]], nsim = 1))
L[[3]] <- as.list(myCov[[3]])
n <- 10
X <- matrix(runif(n * d), nrow = n,
dimnames = list(NULL, paste("x", 1:d, sep = "")))
for (iTest in 1:3) {
C <- covMat(L[[iTest]][[1]], X[ , 1, drop = FALSE])
for (j in 2:d) {
C <- C * covMat(L[[iTest]][[j]], X[ , j, drop = FALSE])
}
CTest <- covMat(myCov[[iTest]], X)
print(max(abs(abs(C - CTest))))
}
Run the code above in your browser using DataLab