Learn R Programming

RKHSMetaMod (version 1.1)

calc_Kv: Function to calculate the Gram matrices and their eigenvalues and eigenvectors for a chosen reproducing kernel.

Description

Calculates the Gram matrices \(K_v\) for \(v=1,\ldots,\)vMax, and returns their associated eigenvalues and eigenvectors. The calculated Gram matrices may be not positive definite. The option "correction" of this function allows to replace the matrices \(K_v\) that are not positive definite by their "nearest positive definite" matrices.

Usage

calc_Kv(X, kernel, Dmax, correction, verbose, tol)

Arguments

X

Matrix of observations with \(n\) rows and \(d\) columns.

kernel

Character, the type of the reproducing kernel: matern \((\)matern kernel\()\), brownian \((\)brownian kernel\()\), gaussian \((\)gaussian kernel\()\), linear \((\)linear kernel\()\), quad \((\)quadratic kernel\()\).

Dmax

Integer, between \(1\) and \(d\), indicates the order of interactions considered in the meta model: Dmax\(=1\) is used to consider only the main effects, Dmax\(=2\) to include the main effects and the interactions of order \(2,\ldots\).

correction

Logical, if TRUE, the program makes the correction to the matrices \(K_v\) that are not positive definite (see details). Set as TRUE by default.

verbose

Logical, if TRUE, the group \(v\) for which the correction is done is printed. Set as TRUE by default.

tol

Scalar, used if correction is TRUE. For each matrix \(K_v\) if \(\lambda_{min} < \lambda_{max}\times\)tol, then the correction to \(K_v\) is done (see details). Set as \(1e^{-8}\) by default.

Value

List of two components "names.Grp" and "kv":

names.Grp

Vector of size vMax, indicates the name of groups included in the meta model.

kv

List of vMax components with the same names as the vector names.Grp. Each element of the list is a list of two components "Evalues" and "Q":

Evalues

Vector of size \(n\), eigenvalues of each Gram matrix \(K_v\).

Q

Matrix with \(n\) rows and \(n\) columns, eigenvectors of each Gram matrix \(K_v\).

Details

Let \(\lambda_{v,i},i=1,...,n\) be the eigenvalues associated with matrix \(K_v\). Set \(\lambda_{max}={max}_{i}\lambda_{v,i}\) and \(\lambda_{min}={min}_{i}\lambda_{v,i}\). The eigenvalues of \(K_v\) that is not positive definite are replaced by \(\lambda_{v,i}+\)epsilon, with espilon\(=\lambda_{max}\times\)tol. The value of tol depends on the type of the kernel and it is chosen small.

References

Kamari, H., Huet, S. and Taupin, M.-L. (2019) RKHSMetaMod : An R package to estimate the Hoeffding decomposition of an unknown function by solving RKHS Ridge Group Sparse optimization problem. <arXiv:1905.13695>

See Also

RKHSMetaMod

Examples

Run this code
# NOT RUN {
d <- 3
n <- 50
library(lhs)
X <- maximinLHS(n, d)
c <- c(0.2,0.6,0.8)
F <- 1;for (a in 1:d) F <- F*(abs(4*X[,a]-2)+c[a])/(1+c[a])
epsilon <- rnorm(n,0,1);sigma <- 0.2
Y <- F + sigma*epsilon
Dmax <- 3
kernel <- "matern"
Kv <- calc_Kv(X, kernel, Dmax)
names <- Kv$names.Grp
Eigen.val1 <- Kv$kv$v1.$Evalues
Eigen.vec1 <- Kv$kv$v1.$Q
# }

Run the code above in your browser using DataLab