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 (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 \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 (x_{j,1}, x_{j,3})
where
x_{j,1}
in newX1
and x_{j,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)
.
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)
|
Value
It returns a vector of length newX1
of estimators
\hat P(X_1 \leq x_1 | X_3 = x_3)
for every couple (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