inst/BookEx/C13R4.R

## Back-test function
BT <- function(DataSub, BLR){
  DataSub <- as.timeSeries(DataSub)
  PPrior <- tangencyPortfolio(data = DataSub, spec = MSPrior,
                              constraints = BoxC)
  PBl <- tangencyPortfolio(data = DataSub, spec = MSBl,
                           constraints = BoxC)
  Weights <- rbind(getWeights(PPrior), getWeights(PBl))
  colnames(Weights) <- ANames
  rownames(Weights) <- c("Prior", "BL")
  return(Weights)
}
## Conducting back-test
Backtest <- list()
for(i in 1:length(idx)){
  DataSub <- window(R, start = start(AssetsM), end = idx[i])
  BLR <- PostDist[[i]]
  Backtest[[i]] <- BT(DataSub, BLR)
}

Try the FRAPO package in your browser

Any scripts or data that you put into this service are public.

FRAPO documentation built on May 2, 2019, 6:33 a.m.