####################################################### ############ Program: Simulation of copulas ########### ####################################################### # Author: Shengyu ZHENG (ESSEC Business School, Grande Ecole Program, Master in Management, 2020-2024) # Version: 23/11/2023 # Objective of this file: To simulate 3 typical copulas # Structure of this file: # I: Prepration # II: Simulation of a normal copula # III: Simulation of a Clayton copula (a type of Archimedean copula) # IV: Simulation of a Tawn copula (a type of Extre Value copula) # I: Prepration if (!require(copula)) install.packages('copula') library(copula) n_samples <- 10000 # Number of simulated samples # II: Simulation of normal copula # Create a bivariate normal copula object with parameter being 0.8 normal_copula <- normalCopula(0.8,dim = 2) # Generate random samples from the copula set.seed(100) normal_copula_samples <- rCopula(n_samples, normal_copula) # Plot the simulated data plot(normal_copula_samples[, 1], normal_copula_samples[, 2], main = "Simulated Normal Copula", xlab = "U1", ylab = "U2") # III: Simulation of Clayton copula (a type of Archimedean copula) # Create a Clayton copula object with parameter being 3 clayton_copula <- claytonCopula(3, dim = 2) # Generate random samples from the copula set.seed(101) clayton_copula_samples <- rCopula(n_samples, clayton_copula) # Plot the simulated data plot(clayton_copula_samples[, 1], clayton_copula_samples[, 2], main = "Simulated Clayton Copula", xlab = "U1", ylab = "U2") # IV: Simulation of a Tawn copula (a type of Extre Value copula) # Create a Tawn copula object with parameter being 0.8 tawn_copula <- tawnCopula(param = 0.8) # Generate random samples from the copula set.seed(102) tawn_copula_samples <- rCopula(n_samples, tawn_copula) # Plot the simulated data plot(tawn_copula_samples[, 1], tawn_copula_samples[, 2], main = "Simulated Tawn Copula", xlab = "U1", ylab = "U2")