View source: R/internal.R View source: R/generateKernelMatrix.R
generateKernelMatrix | R Documentation |
Given a n \times p matrix of sample observations indexed by row and a choice of kernel function, returns an empirical estimate of the n \times n matrix whose (i,j)th entry is the centralized version of the kernel function evaluated at the pair of rows i and j of x
.
generateKernelMatrix(x, kernel_function = "gau")
x |
a numeric matrix containing the sample data with observations indexed by row. |
kernel_function |
a character string identifying the kernel function to use. For a list of valid strings, use |
If the kernel function is expressed as f(x_1, x_2) for two p-dimensional vectors x_1 and x_2, then generateKernelMatrix
first computes the non-centralized empirical kernel matrix K whose (i,j)th entry is f(x_i, x_j), where x_i and x_i are the ith and jth rows of x
, respectively. Letting K* denote a copy of K with zero entries along the main diagonal and J denote a n \times n matrix of ones, the empirical centralized kernel matrix is then computed as
K - (JK* + K*J - JK*J / n) / (n - 1)
.
Details on the available kernel functions can be found in the help topic for listAmkatKernelFunctions
.
A square numeric matrix with the same row dimension as x
, whose (i,j)th entry is the empirically centralized value for kernel-based pairwise similarity between rows i and j of x
.
Brian Neal
Neal, Brian and He, Tao. “An adaptive multivariate kernel-based test for association with multiple quantitative traits in high-dimensional data.” Genetic Epidemiology (not yet submitted).
x <- matrix(rnorm(50 * 25), nrow = 25, ncol = 50) ker_mat_lin <- generateKernelMatrix(x, "lin") ker_mat_quad <- generateKernelMatrix(x, "quad") ker_mat_gau <- generateKernelMatrix(x, "gau") ker_mat_exp <- generateKernelMatrix(x, "exp") x <- matrix(rbinom(n = 50 * 25, size = 2, prob = 0.25), nrow = 25, ncol = 50) ker_mat_ibs <- generateKernelMatrix(x, "IBS")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.