Description Usage Arguments Value Examples
Extract a subset of variables from a Gaussian Copula distribution.
1 |
gCop |
A |
subset |
Integer or logical vector specifying which subset of variables to keep. Default is to keep all variables. |
A gaussCop
object representing the marginal Gaussian Copula distribution on the subset of variables.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # simulate data
n <- 5e4
X <- cbind(rnorm(n, mean = 1, sd = 3),
rnorm(n, mean=4, sd = 0.5),
rt(n, df = 10),
rchisq(n, df = 5),
rnorm(n, mean=10, sd = 10))
# fit Gaussian Copula using Kernel method
gCop <- gcopFit(X, fitXD = "kernel")
# subset gCop
isub <- sample(5, 3) # subset
gCop.sub <- gcopSub(gCop, subset = isub)
# check that subsetted xDensity representations are the same
for(ii in 1:3) {
print(identical(gCop$XDens[[isub[ii]]], gCop.sub$XDens[[ii]]))
}
# check that subsetted correlation matrix is the same
print(identical(gCop$Rho[isub,isub], gCop.sub$Rho))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.