Skip to contents

Given a sample (from some probability distribution) this function makes a Copula fit to the source distribution using the VineCopula package.

Usage

fitCopula(X)

Arguments

X

sample that characterizes the target distribution (rows)

Value

as list: copula, U, Z, and Y where U are marginal probability samples, Z are cumulative density values for U, and Y are the probability density values of U.

Examples

rprior <- rNormalPrior(c(1,2,3),c(4,5,6))
X <- rprior(1000)
C <- fitCopula(X)
rCopula <- rCopulaPrior(C)
Z <- rCopula(1000)
print(norm(cov(X) - cov(Z),"2")/norm(X,"2"))
#> [1] 0.006741844
print(abs(sum(colMeans(X) - colMeans(Z)))/sum(colMeans(X)))
#> [1] 0.02346827