Advertisement
Guest User

Untitled

a guest
May 24th, 2016
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. Fund.ID Vintage Type Region.Focus Net.Multiple Size
  2. [1,] 4716 2003 2 US 1.02 Small
  3. [2,] "2237 1998 25 Europe 0.03 Medium
  4. [3,] 1110 1992 2 Europe 1.84 Medium
  5. [4,] 12122 1997 25 Asia 2.04 Large
  6. [5,] 5721 2006 25 US 0.86 Mega
  7. [6,] 730 1998 2 Europe 0.97 Small
  8.  
  9. ##10 funds
  10. for(i in 1982:2005)
  11. {
  12. t <- i:(i+5)
  13. x <- subset(dataset, Vintage == i) ##instead of dataset, you can use any other subset
  14. pf <- subset(dataset, Vintage %in% t) ##change dataset here as well then
  15. m <- 1000 %*% nrow(x) %/% nrow(dataset) ##function simulates portfolios proportional to number of funds per year, change dataset here as well then
  16. n <- nrow(pf)
  17. weight <- rlongonly(m = m, n = n, k = 10, x.t = 1, x.l = 0.01, x.u = 0.3, max.iter = 1000)
  18. year.fof <- paste("fof.tvpi.10", i, sep = ".")
  19. assign(year.fof, weight %*% pf$Net.Multiple..X.)
  20. colnames(weight) <- pf[, 3]
  21. year.weight <- paste("weight.10", i, sep =".")
  22. assign(year.weight, weight)
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement