Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: kernel
See also: repa rqua rtri rtrian runi

Quantlet: rkernpq
Description: Computes the radial kernel of the form: C (1-r^q)^p.

Usage: y = rkernpq (x, p, q)
Input:
x n x d matrix of user-defined data
p scalar, positive integer
q scalar, positive integer
Output:
y n x 1 matrix containing the radial kernel

Note:

Example:
; Quartic kernel in d dimensions
library("kernel")
p  = 2
q  = 2
d  = 3
; choose n points, uniformly distributed in [-1,1]^d
n  = 1000
x  = 2*uniform(n,d)-1
; compute kernel values
y  = rkernpq(x, p, q)
; approximate the integral about the kernel
; function in [-1,1]^d
sum(y.*2^d/n)

Result:
Independent of p, q and d you should get approximately 1
as result. Note that for higher dimensions n has to be
increased!
Example:
; Quartic kernel in d dimensions
library("kernel")
p  = 2
q  = 2
d  = 2
; create uniform grid in [-1,1]^d
o  = matrix(d)
n  = 50.*o
h  = 2/(n-1).*o
x0 = -o
x  = grid(x0, h, n)
; compute kernel values
y  = rkernpq(x, p, q)
; show kernel function(d<3)
library("plot")
plot(x~y)

Result:
Shows the radial kernel. Note that d can only take
the values d=1 or d=2 to show something useful!



Author: S. Klinke, 20011031
(C) MD*TECH Method and Data Technologies, 05.02.2006