Summary Summary Using R for Evaluating Trading Using R for Evaluating Trading Strategies Strategies � R is a good thing R is a good thing � � Random portfolios are useful Random portfolios are useful � Patrick Burns Patrick Burns http://www.burns- -stat.com stat.com http://www.burns � More information at More information at � http://www.burns- -stat.com stat.com http://www.burns June 2006 June 2006 filename 1 filename 2 Backtest Backtest Results Results Emerging Market Fund Emerging Market Fund 1.20 20 Wealth 1.10 16 12 1.00 8 1997 1998 1999 2000 2001 2002 2003 2004 2005 1998 1999 2000 2001 filename 3 filename 4 • 1
Testing Investment Portfolios A Permutation Test Testing Investment Portfolios A Permutation Test � � An amount of money in each asset An amount of money in each asset � Test if result is better than a guess Test if result is better than a guess � (typically including a lot of zeros) (typically including a lot of zeros) � Permute the amounts among the Permute the amounts among the � � Computers exist Computers exist � assets assets � Implies a random permutation test Implies a random permutation test � � Takes at most 6 lines of R Takes at most 6 lines of R � filename 5 filename 6 There There’ ’s a Problem s a Problem Typical Constraints Typical Constraints • Non-negative weights (no short selling) � � Portfolios are not a haphazard Portfolios are not a haphazard collection of assets collection of assets • weights less than some limit � � The permuted portfolios are not The permuted portfolios are not • weights within some limit of benchmark realistic realistic weights � � In particular volatility is too large In particular volatility is too large • Country constraints (linear) • Industry constraints (linear) • Liquidity constraints filename 7 filename 8 • 2
Practical Constraints Random Portfolios Practical Constraints Random Portfolios � � Limit turnover Limit turnover � � Sample from the set of portfolios that Sample from the set of portfolios that obey all constraints obey all constraints � Limit number of assets traded Limit number of assets traded � � This is non This is non- -trivial trivial � � Limit number of assets in portfolio Limit number of assets in portfolio � � Uses a genetic algorithm typically Uses a genetic algorithm typically � Threshold constraints � Threshold constraints � filename 9 filename 10 So Why is R Still Important? So Why is R Still Important? A Valid A Valid “ “Permutation Permutation” ” Test Test � � Now have a whole pile of portfolios Now have a whole pile of portfolios � Generate a random sample of � Generate a random sample of portfolios that satisfy given constraints portfolios that satisfy given constraints � Want to step through time in Want to step through time in backtests backtests � � � Compare actual result to distribution Compare actual result to distribution � Want to graph results � Want to graph results from random portfolios from random portfolios filename 11 filename 12 • 3
Backtest Results Results The Random Paths Backtest The Random Paths 1.20 1.2 1.0 Wealth Wealth 0.8 1.10 0.6 0.4 1.00 1998 1999 2000 2001 1998 1999 2000 2001 filename 13 filename 14 Random Quantiles Random Quantiles Whole Period from Random Starts Whole Period from Random Starts 1.0 1.2 Whole Period P-values 0.8 1.0 0.6 Wealth 0.8 0.4 0.6 0.4 0.2 1998 1999 2000 2001 0.0 0.2 0.4 0.6 0.8 1.0 Theoretical Quantiles filename 15 filename 16 • 4
10- -day Non day Non- -overlapping p overlapping p- -values values 10 1.0 0.8 Combined p-value 0.6 0.4 0.2 0.0 1998 1999 2000 2001 filename 17 filename 18 • 5
Recommend
More recommend