I am fairly new to PortfolioAnalytics and R in general. I am trying to do some backtesting of a minimum variance portfolio.
I have weekly, monthly, quarterly and yearly return data of 3 selected stocks. My goal is to assess the performance of a minimum variance portfolio with frequent rebalancing (i.e. every week; month; quarter; year the portfolio should be rebalanced to the Minimum Variance Portfolio).
I want to make sure that the entire history of financial data up to the rebalancing date is being used when the rebalancing is performed, which I think should be specified in the "training_period". How do I achieve this?
Example for monthly rebalancing:
library(PortfolioAnalytics) # Create portfolio: portf <- portfolio.spec(colnames(m_returns)) portf <- add.constraint(portf, type = "weight_sum", min_sum = 0.99, max_sum = 1.01) portf <- add.constraint(portf, type = "long_only") portf <- add.objective(portf, type="return", name="mean", portfolio = portf) portf <- add.objective(portf, type="risk", name="StdDev", portfolio = portf ) # Backtesting: rp <- random_portfolios(portf, 10000, "sample") # set of random portfolios to prevent recalculation opt_rebal <- optimize.portfolio.rebalancing(m_returns, portf, optimize_method = "random", rp = rp, rebalance_on = "months", training_period = 1, rolling_window = 1)
Note: "m_returns" is in monthly frequency. Now if I set the training_period to 1, then I think that only 1 past month is being used for every monthly optimization (rolling_window = 1). Is this correct?
Again: The goal is to achieve an ongoing optimization that takes into account all the previous data points up to the point where the rebalancing happens (i.e. there will be a growing amount of data points for each rebalancing, which is in line with reality).
I have to admit that I am not 100% sure I have correctly understood the concept of "rolling_window" and "training_period". Could anybody help me out with this?
Thank you in advance!