CalcLambda: Calculate lambda and other attributes of the combinatoric...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/PBOFun.R

Description

Calculate the lambda as defined in step (g) on p.12 of Bailey et al (2015). Lambda is the logit of the relative rank (w.bar) of the best training strategy in the matching validation set J_bar. It is calculated as follow, For each train set, 1) find the column in train set with the best performance (eg. highest Sharpe ratio), 2) find its corresponding validation performance in the validation set Val, 3) calculate the rank of this column in Val, 4) lambda is the logit of this Val rank

Usage

1
2
CalcLambda(Train, Val, eval.method = "ave", risk.free.rate = 0.02,
  rank.ties.method = "random", verbose = FALSE)

Arguments

Train

list of matrices

Val

list of matrices, same length as Train

eval.method

method of evaluating the columns (strategies), default is 'ave', but support 'SR'

risk.free.rate

risk free rate for Sharpe ratio calculation, default is 0.02.

Details

The default method of evaluation is 'ave', which averages the columns. The best column is the one with the maximum average. This would be appropriate if the matrix contains returns over a fixed period. The alternative is 'SR', or the Sharpe ratio. If the data are returns over a time period, it is better to use Sharpe ratio ("SR").

Value

list of elements : lambda, n.star, w.bar, IS.best, OOS

Author(s)

Horace W. Tso horacetso@gmail.com

References

Bailey, D. H., Borwein, J., Lopez de Prado, M., & Zhu, Q. J. (2016). The probability of backtest overfitting. https://www.carma.newcastle.edu.au/jon/backtest2.pdf

Lopez de Prado (2018), Advances in Financial Machine Learning, John Wiley & Sons.

See Also

PBO::PBO()

Examples

1
2
3
4
5
   M = matrix(rnorm(N*TT, mean=0.1, sd=1), ncol=N, nrow=TT)
   Ms = DivideMat(M, S)
   res <- TrainValSplit(Ms)
   res1 <- CalcLambda(res$Train, res$Val, eval.method="ave")
   (Lambda = res1$lambda)

htso/PBO documentation built on Jan. 31, 2020, 4:20 p.m.