Created
March 27, 2016 21:36
-
-
Save mick001/9c0fae17d7b39071c815 to your computer and use it in GitHub Desktop.
How to fit a copula model in R [heavily revised]. Part 2: fitting the copula. Full article at
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
# Sample 1000 observations from the distribution | |
sim <- rmvdc(my_dist, 1000) | |
# Plot the data for a visual comparison | |
plot(mydata$x, mydata$y, main = 'Test dataset x and y', col = "blue") | |
points(sim[,1], sim[,2], col = 'red') | |
legend('bottomright', c('Observed', 'Simulated'), col = c('blue', 'red'), pch=21) | |
cor(mydata, method = "kendall") | |
## x y | |
## x 1.0000000 0.4212052 | |
## y 0.4212052 1.0000000 | |
cor(sim, method = "kendall") | |
## [,1] [,2] | |
## [1,] 1.0000000 0.4082803 | |
## [2,] 0.4082803 1.0000000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment