Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. library(VineCopula)
  2. library(copula)
  3.  
  4. u <- pobs(as.matrix(cbind(stock1,stock2)))[,1]
  5. v <- pobs(as.matrix(cbind(stock1,stock2)))[,2]
  6. selectedCopula <- BiCopSelect(u,v,familyset=NA)
  7.  
  8. Bivariate copula: BB8 (par = 1.78, par2 = 0.86, tau = 0.19)
  9.  
  10. copula <- BB8Copula(param = c(1.78,0.86))
  11. m <- pobs(as.matrix(cbind(stock1,stock2)))
  12. fit <- fitCopula(copula,m,method='itau')
  13. coef(fit)
  14.  
  15. my_dist <- mvdc(claytonCopula(param = 1.48, dim = 2), margins = c("gamma","gamma"), paramMargins = list(list(shape = x_shape, rate = x_rate), list(shape = y_shape, rate = y_rate)))
  16.  
  17. sim <- rMvdc(306, my_dist)
  18. cor(cbind(stock1,stock2), method = "kendall")
  19. cor(sim, method = "kendall")
  20.  
  21. > cor(cbind(stock1,stock2), method = "kendall")
  22. stock1 stock2
  23. stock1 1.0000000 0.1955256
  24. stock2 0.1955256 1.0000000
  25. > cor(sim, method = "kendall")
  26. [,1] [,2]
  27. [1,] 1.0000000 0.4441659
  28. [2,] 0.4441659 1.0000000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement