1
$\begingroup$

In R-package PortfolioAnalytics, what is the unit of the training_period and rolling_window ? is it the just data points ? or is it related to the rebalance_on period?

Edit/precisions: example: if I put training_period = 50 what is the unit of that 50? Turns out, it's 50 time periods, the same as the returns series.

$\endgroup$
6
  • $\begingroup$ All of the params are defined quite clearly here on pages 83-85: cran.r-project.org/web/packages/PortfolioAnalytics/… There is some example code in that link as well demonstrating one way to implement it. $\endgroup$
    – amdopt
    Apr 20, 2018 at 17:54
  • $\begingroup$ Please quote. I have the pdf. $\endgroup$ Apr 20, 2018 at 18:01
  • $\begingroup$ training_period: an integer of the number of periods to use as a training data in the front of the returns data rolling_window: an integer of the width (i.e. number of periods) of the rolling window, the default of NULL will run the optimization using the data from inception. $\endgroup$
    – amdopt
    Apr 20, 2018 at 18:03
  • $\begingroup$ My question is: what is the period? Is it related to rebalance on? Do they subsample? If I use daily returns, are the periods in days? If monthly, is it months? $\endgroup$ Apr 20, 2018 at 18:05
  • 1
    $\begingroup$ Hi @amdopt, you are right. If the returns are daily, then the training_period and rolling_window are in daily "units". It is not dependent on the rebalance_on parameter. I'm going to edit. If you want to add the answer below so I can accept it. $\endgroup$ Apr 26, 2018 at 8:27

1 Answer 1

1
$\begingroup$

On pages 83-85 in the link below:

training_period: an integer of the number of periods to use as a training data in the front of the returns.

data rolling_window: an integer of the width (i.e., number of periods) of the rolling window, the default of NULL will run the optimization using the data from inception.

So the "type" is integer. The "unit" depends on what data you have...minutes, hours, days, months, quarters, years, etc. That period is the "unit" you are asking about which will also be of "type" integer and will be the same unit as your time series. The other input you ask about, "rebalance_on," is a string input ("Months," "Quarters," etc.). Below is taken directly from page 85 in the link below as well. The code snippet would optimize for ROI via monthly rebalancing with five year training period and 4-year rolling window.

bt.opt2 <- optimize.portfolio.rebalancing(R, portf,
optimize_method="ROI",
rebalance_on="months",
training_period=60,
rolling_window=48)

https://cran.r-project.org/web/packages/PortfolioAnalytics/PortfolioAnalytics.pdf

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.