Hello everyone,
I would like assistance with updating a snippet I have written to do a recursive out-of-sample portfolio optimization. The trouble I am having is with the fact that the return on the riskless asset is time varying and so is different in each period. This is what I have written so far but it does not work; for (i in 1:648) optimized_port= rollapply(asset_forecast, width=1, function(x) portfolio.optim(data = as.data.frame(x), riskless=TRUE, shorts=TRUE, rf= cash_forecast[i,])), by.column = FALSE, by=1, align="right") -cash_forecast is a 648x1 matrix having forecasted risk-free returns -asset_forecast is a 648x7 matrix holding 7 forecasted asset class returns Can someone point out how to incorporate the changing riskfree in this model. Many thanks, Darius [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.