estimateCondCDF_matrix {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.

Usage

estimateCondCDF_matrix(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 (p3, n) \big(K_h(X3[i] - U3[j])\big)_{i,j} such as given by computeKernelMatrix.

Details

This function is supposed to be used with computeKernelMatrix. Assume that we observe a sample (X_{i,1}, X_{i,3}), i=1, \dots, n. We want to estimate the conditional cdf of X_1 given X_3 = x_3 at point x_1 using the following kernel-based estimator

\hat P(X_1 \le 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 x_1 in newX1 and every x_3 in newX3. The matrixK3 should be a matrix of the values K_h(X_{l,3} - x_3) such as the one produced by computeKernelMatrix(observedX3, newX3, kernel, h).

Value

A matrix of dimensions (p1 = length(newX), p3 = length(matrixK3[,1])) of estimators \hat P(X_1 \leq x_1 | X_3 = x_3) for every possible choices of (x_1, x_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 = c(0, 1, 2)
matrixK = computeKernelMatrix(observedX = Y[,2], newX = newY2,
  kernel = "Gaussian", h = 0.8)
# In this matrix, there are the estimated conditionl cdf at points given by newY1
# conditionally to the points given by newY2.
matrixCondCDF = estimateCondCDF_matrix(observedX1 = Y[,1],
  newX1 = newY1, matrixK)
matrixCondCDF


[Package CondCopulas version 0.1.3 Index]