Last active
March 13, 2016 22:20
-
-
Save mick001/981c3a5c2e5758f93046 to your computer and use it in GitHub Desktop.
How to fit a copula model in R [heavily revised]. Part 1: basic tools. Full article at http://firsttimeprogrammer.blogspot.com/2016/03/how-to-fit-copula-model-in-r-heavily.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generate the normal copula and sample some observations | |
coef_ <- 0.8 | |
mycopula <- normalCopula(coef_, dim = 2) | |
u <- rCopula(2000, mycopula) | |
# Compute the density | |
pdf_ <- dCopula(u, mycopula) | |
# Compute the CDF | |
cdf <- pCopula(u, mycopula) | |
# Generate random sample observations from the multivariate distribution | |
v <- rMvdc(2000, multivariate_dist) | |
# Compute the density | |
pdf_mvd <- dMvdc(v, multivariate_dist) | |
# Compute the CDF | |
cdf_mvd <- pMvdc(v, multivariate_dist) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment