Description Usage Arguments Value Author(s) References See Also Examples
Implements the C-vine based estimator of Nagler and Czado (2016). We refer
to kdevine
for more details.
1 |
x |
(n x (d-1)) data matrix. |
y |
(n x 1) data vector for the central node. |
mult_1d |
numeric; all bandwidhts for marginal kernel density estimation
are multiplied with |
xmin |
numeric vector of length d; see |
xmax |
numeric vector of length d; see |
... |
further arguments passed to |
An object of class kdecvine
.
Thibault Vatter
Nagler, T., Czado, C. (2016) Evading the curse of dimensionality in nonparametric density estimation with simplified vine copulas. Journal of Multivariate Analysis 151, 69-89 (doi:10.1016/j.jmva.2016.07.003)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | set.seed(0)
# Quantiles of interest
alpha <- c(0.1,0.5,0.9)
## The predictors
p <- 10
n <- 1e3
X <- matrix(2 * runif(n * p) - 1, n, p)
colnames(X) <- paste0("X", 1:p)
## mean and variance shifts
Y1 <- rnorm(n) + exp(X[,1])
Y2 <- rnorm(n) * (1 + exp(X[,1]))
## For the evaluation of the results
ticks = 1e2
X.test = matrix(0, ticks, p)
X.test[,1] = seq(-0.9, 0.9, length.out = ticks)
colnames(X.test) <- paste0("X", 1:p)
## The truth
truth1 <- cbind(qnorm(0.1) + exp(X.test[,1]),
exp(X.test[,1]),
qnorm(0.9) + exp(X.test[,1]))
truth2 <- cbind(qnorm(0.1) * (1 + exp(X.test[,1])),
0,
qnorm(0.9) * (1 + exp(X.test[,1])))
## range for the margin estimates
xmin <- c(-Inf,rep(-1, p))
xmax <- c(Inf,rep(1, p))
## Can we identify the right structure?
rvr1 <- kdecvine(x = X, y = Y1, xmin = xmin, xmax = xmax,
test.level = 0.05, trunc.level = 1, treecrit = "hoeffd")
rvr2 <- kdecvine(x = X, y = Y2, xmin = xmin, xmax = xmax,
test.level = 0.05, trunc.level = 1, treecrit = "hoeffd")
## Quantile regression results
rq1 <- predict(rvr1, X.test, "quantile", tau = c(0.1, 0.5, 0.9))
rq2 <- predict(rvr2, X.test, "quantile", tau = c(0.1, 0.5, 0.9))
## Plot the results
par(mfrow = c(1,2))
plot(X[,1], Y1, xlab = "X1", ylab = "Y1")
matlines(X.test[,1], truth1, col = "green", lty = c(2,1,2), lwd = 2)
matlines(X.test[,1], rq1, col = "red", lty = c(2,1,2), lwd = 2)
legend("topleft", legend = c("data", "truth", "estimate"),
col = c(1, "green", "red"),
pch = c(1, rep(NA,2)),
lty = c(0, rep(1,2)),
cex = 0.7)
plot(X[,1], Y2, xlab = "X1", ylab = "Y2")
matlines(X.test[,1], truth2, col = "green", lty = c(2,1,2), lwd = 2)
matlines(X.test[,1], rq2, col = "red", lty = c(2,1,2), lwd = 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.