X2kernel {plsdof}R Documentation

Computation of the kernel matrix

Description

This function computes the Gram matrices for a gaussian kernel and differnt kernel widths.

Usage

X2kernel(X, Xtest = NULL, sigma = 1)

Arguments

X matrix of predictor observations.
Xtest optional matrix of test observations. Default is Xtest=NULL.
sigma vector of kernel widths. Default is sigma=1.

Details

We first scale X such that the range of each column lies in [-1,1]. Additionally, the data is centered in feature space. If test data is provided, the same transformations are also applied to them.

The default value for sigma is in general NOT a sensible parameter, and sigma should always be selected via a model selection criterion.

Value

K array of kernel matrices
Ktest array of kernel matrices for Xtest, if provided
sigma vector of kernel widths

Author(s)

Nicole Kraemer

See Also

X2kernel, kernel.pls, kernel.pls.ic, kernel.pls.cv

Examples

p<-20 # number of variables
n<-100 # number of observations
ntest<-50 # number of test observations

X<-matrix(rnorm(n*p),ncol=p)
Xtest<-matrix(rnorm(ntest*p),ncol=p)
sigma<-exp(seq(0,4,length=10))

kernel.object<-X2kernel(X,Xtest,sigma=sigma)


[Package plsdof version 0.1-1 Index]