Skip to content
All library documents

Expanding Training Windows for Minimum-Variance Portfolio Rebalancing

Article Quant Q&A · Author: LarLee8

Summary

The document asks how to backtest a minimum-variance portfolio that is rebalanced at regular intervals while using all return observations available before each rebalance. It focuses on the training-period and rolling-window arguments in PortfolioAnalytics’ rebalancing optimizer, and whether setting both to one for monthly data would restrict each optimization to only the prior month. The example uses monthly returns, a long-only constraint, and a weight-sum constraint.

The desired procedure is an expanding history: the estimation window should grow as new observations arrive, rather than remain limited to a fixed-length rolling sample. However, the document contains only the question and example, with no answer confirming the package’s argument semantics or showing the correct settings. It therefore identifies an important backtest design choice but does not establish how to configure the function. Users should verify the package documentation and behavior for their version before interpreting results, and should distinguish an expanding window from a fixed rolling window.

Key ideas

  • The backtest aims to rebalance a minimum-variance portfolio at weekly, monthly, quarterly, or yearly intervals.
  • The stated objective is to use all observations available before each rebalance, creating an expanding estimation history.
  • The example asks whether a one-period training setting with a one-period rolling window uses only one prior observation.
  • No answer is provided, so the correct function settings and parameter semantics remain unresolved.
  • Backtest interpretation depends on verifying whether the estimation window expands or rolls at a fixed length.

Tags

Full text
# PortfolioAnalytics: Training window based on entire history before rebalancing in 'optimize.portfolio.rebalancing'?


# PortfolioAnalytics: Training window based on entire history before rebalancing in 'optimize.portfolio.rebalancing'?












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!

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.