computeKernelMatrix {CondCopulas}R Documentation

Computing the kernel matrix

Description

This function computes a matrix of dimensions (length(observedX3), length(newX3)), whose element at coordinate (i,j) is K_{h}(observedX3[i] - newX3[j] ), where K_h(x) := K(x/h) / h and K is the kernel.

Usage

computeKernelMatrix(observedX, newX, kernel, h)

Arguments

observedX

a numeric vector of observations of X3. on the interval [0,1].

newX

a numeric vector of points of X3.

kernel

a character string describing the kernel to be used. Possible choices are Gaussian, Triangular and Epanechnikov.

h

the bandwidth

Value

a numeric matrix of dimensions (length(observedX), length(newX))

See Also

estimateCondCDF_matrix, estimateCondCDF_vec,

Examples

Y = MASS::mvrnorm(n = 100, mu = c(0,0), Sigma = cbind(c(1, 0.9), c(0.9, 1)))
matrixK = computeKernelMatrix(observedX = Y[,2], newX = c(0, 1, 2.5),
kernel = "Gaussian", h = 0.8)

# To have an estimator of the conditional expectation of Y1 given Y2 = 0, 1, 2.5
Y[,1] * matrixK[,1] / sum(matrixK[,1])
Y[,1] * matrixK[,2] / sum(matrixK[,2])
Y[,1] * matrixK[,3] / sum(matrixK[,3])


[Package CondCopulas version 0.1.3 Index]