search for: mcpfunction

Displaying 1 result from an estimated 1 matches for "mcpfunction".

Did you mean: malfunction
2011 Oct 22
1
Help w/an old R program I've rediscovered and want to make work
...- 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 != 0] # makes life easier - It deletes the very rare 0 x-day returns if (i==1) result...