estimateCondCDF_vec {CondCopulas}R Documentation

Compute kernel-based conditional marginal (univariate) cdfs

Description

This function computes an estimate of the conditional (marginal) cdf of X1 given a conditioning variable X3. This function is supposed to be used with computeKernelMatrix. Assume that we observe a sample (Xi,1,Xi,3),i=1,,n(X_{i,1}, X_{i,3}), i=1, \dots, n. We want to estimate the conditional cdf of X1X_1 given X3=x3X_3 = x_3 at point x1x_1 using the following kernel-based estimator

P^(X1x1X3=x3):=l=1n1{Xl,1x1}Kh(Xl,3x3)l=1nKh(Xl,3x3),\hat P(X_1 \leq x_1 | X_3 = x_3) := \frac{\sum_{l=1}^n 1 \{X_{l,1} \leq x_1 \} K_h(X_{l,3} - x_3)} {\sum_{l=1}^n K_h(X_{l,3} - x_3)},

for every couple (xj,1,xj,3)(x_{j,1}, x_{j,3}) where xj,1x_{j,1} in newX1 and xj,3x_{j,3} in newX3. The matrixK3 should be a matrix of the values Kh(Xl,3x3)K_h(X_{l,3} - x_3) such as the one produced by computeKernelMatrix(observedX3, newX3, kernel, h).

Usage

estimateCondCDF_vec(observedX1, newX1, matrixK3)

Arguments

observedX1

a sample of observations of X1 of size n

newX1

a sample of new points for the variable X1, of size p1

matrixK3

a matrix of kernel values of dimension (p2 , n) (Kh(X3[i]U3[j]))i,j\big(K_h(X3[i] - U3[j])\big)_{i,j} such as given by computeKernelMatrix.

Value

It returns a vector of length newX1 of estimators P^(X1x1X3=x3)\hat P(X_1 \leq x_1 | X_3 = x_3) for every couple (xj,1,xj,3)(x_{j,1}, x_{j,3}).

Examples

Y = MASS::mvrnorm(n = 100, mu = c(0,0), Sigma = cbind(c(1, 0.9), c(0.9, 1)))
newY1 = seq(-1, 1, by = 0.5)
newY2 = newY1
matrixK = computeKernelMatrix(observedX = Y[,2], newX = newY2,
  kernel = "Gaussian", h = 0.8)
vecCondCDF = estimateCondCDF_vec(observedX1 = Y[,1],
  newX1 = newY1, matrixK)
vecCondCDF


[Package CondCopulas version 0.1.3 Index]