library(copula) # declare a Gaussian copula class with a 0.7 correlation norm.cop <- normalCopula(0.7) # generate 500 realizations of two uniformly distributed random variables # with the Gaussian copula dependency structure set.seed(117) u1 <- rCopula(500, norm.cop) # define a t-copula class with a 0.7 correlation and 4 degrees of freedom t.cop <- tCopula(0.7, df = 4) # generate 500 realizations of pairs of random variables with t-copula dependence set.seed(117) u2 <- rCopula(500, t.cop) # Plot the results into two graphs next to each other par(mfcol = c(1, 2)) plot(u1, main = 'Random Variable Pairs Generated by Gaussian Copula') plot(u2, main = 'Random Variable Pairs Generated by t-Copula') fit.ml <- fitCopula(norm.cop, u1, method = "ml") #fit.ml <- fitCopula(t.cop, u1, method = "ml") fit.ml