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