Displaying 1 result from an estimated 1 matches for "mcpsplitlist".
2011 Oct 22
1
Help w/an old R program I've rediscovered and want to make work
...ad to
losing last few elements, but makes life easier
for (i in 1:LoopsNumber)
{
MCP <- sample(data$gspc, replace = FALSE) # resampling here without
replacement = permutations, not bootstrap
# computing period returns
MCP <- MCP[1:(WindowPeriod*PeriodsNumber)] #loses last few elements
MCPsplitlist <- 1:PeriodsNumber
MCPsplitlist <- rep(MCPsplitlist, each=WindowPeriod)
MCPfunction <- function(y) {cumprod(1+y)* c(rep(0,WindowPeriod-1),1)}
MCPcumprod <- tapply(MCP, MCPsplitlist, MCPfunction)
MCPcumprod <- unlist(MCPcumprod, use.names=FALSE)
MCPcumprod <- MCPcumprod[MCPcumprod...