PORTFOLIO THEORY: MANAGING BIG DATA

Similar documents
A random variable is a variable whose value is a numerical outcome of a random phenomenon.

Models of Asset Pricing

Appendix 1 to Chapter 5

Models of Asset Pricing

Models of Asset Pricing

Statistics for Economics & Business

point estimator a random variable (like P or X) whose values are used to estimate a population parameter

of Asset Pricing R e = expected return

CAPITAL ASSET PRICING MODEL

1 Random Variables and Key Statistics

of Asset Pricing APPENDIX 1 TO CHAPTER EXPECTED RETURN APPLICATION Expected Return

Anomaly Correction by Optimal Trading Frequency

Overlapping Generations

Estimating Proportions with Confidence

5. Best Unbiased Estimators

Dr. Maddah ENMG 624 Financial Eng g I 03/22/06. Chapter 6 Mean-Variance Portfolio Theory

Combining imperfect data, and an introduction to data assimilation Ross Bannister, NCEO, September 2010

Binomial Model. Stock Price Dynamics. The Key Idea Riskless Hedge

We learned: $100 cash today is preferred over $100 a year from now

Subject CT1 Financial Mathematics Core Technical Syllabus

FINM6900 Finance Theory How Is Asymmetric Information Reflected in Asset Prices?

CAPITAL PROJECT SCREENING AND SELECTION

Sampling Distributions and Estimation

Chapter 8. Confidence Interval Estimation. Copyright 2015, 2012, 2009 Pearson Education, Inc. Chapter 8, Slide 1

AY Term 2 Mock Examination

APPLICATION OF GEOMETRIC SEQUENCES AND SERIES: COMPOUND INTEREST AND ANNUITIES

First determine the payments under the payment system

Using Math to Understand Our World Project 5 Building Up Savings And Debt

STRAND: FINANCE. Unit 3 Loans and Mortgages TEXT. Contents. Section. 3.1 Annual Percentage Rate (APR) 3.2 APR for Repayment of Loans

r i = a i + b i f b i = Cov[r i, f] The only parameters to be estimated for this model are a i 's, b i 's, σe 2 i

Monetary Economics: Problem Set #5 Solutions

Notes on Expected Revenue from Auctions

CHAPTER 2 PRICING OF BONDS

Calculation of the Annual Equivalent Rate (AER)

14.30 Introduction to Statistical Methods in Economics Spring 2009

Chapter 8: Estimation of Mean & Proportion. Introduction

ST 305: Exam 2 Fall 2014

Introduction to Probability and Statistics Chapter 7

. (The calculated sample mean is symbolized by x.)

Lecture 4: Parameter Estimation and Confidence Intervals. GENOME 560 Doug Fowler, GS

Basic formula for confidence intervals. Formulas for estimating population variance Normal Uniform Proportion

Today: Finish Chapter 9 (Sections 9.6 to 9.8 and 9.9 Lesson 3)

1 The Power of Compounding

Chapter 5: Sequences and Series

The Time Value of Money in Financial Management

ii. Interval estimation:

INTERVAL GAMES. and player 2 selects 1, then player 2 would give player 1 a payoff of, 1) = 0.

Lecture 4: Probability (continued)

Topic-7. Large Sample Estimation

Parametric Density Estimation: Maximum Likelihood Estimation

NPTEL DEPARTMENT OF INDUSTRIAL AND MANAGEMENT ENGINEERING IIT KANPUR QUANTITATIVE FINANCE END-TERM EXAMINATION (2015 JULY-AUG ONLINE COURSE)

Inferential Statistics and Probability a Holistic Approach. Inference Process. Inference Process. Chapter 8 Slides. Maurice Geraghty,

Online appendices from Counterparty Risk and Credit Value Adjustment a continuing challenge for global financial markets by Jon Gregory

CHAPTER 8 Estimating with Confidence

The material in this chapter is motivated by Experiment 9.

When you click on Unit V in your course, you will see a TO DO LIST to assist you in starting your course.

Maximum Empirical Likelihood Estimation (MELE)

Chapter 4 - Consumer. Household Demand and Supply. Solving the max-utility problem. Working out consumer responses. The response function

An Empirical Study of the Behaviour of the Sample Kurtosis in Samples from Symmetric Stable Distributions

Math 124: Lecture for Week 10 of 17

Problem Set 1a - Oligopoly

Standard Deviations for Normal Sampling Distributions are: For proportions For means _

Introduction to Financial Derivatives

A New Constructive Proof of Graham's Theorem and More New Classes of Functionally Complete Functions

ACTUARIAL RESEARCH CLEARING HOUSE 1990 VOL. 2 INTEREST, AMORTIZATION AND SIMPLICITY. by Thomas M. Zavist, A.S.A.

Limits of sequences. Contents 1. Introduction 2 2. Some notation for sequences The behaviour of infinite sequences 3

Confidence Intervals. CI for a population mean (σ is known and n > 30 or the variable is normally distributed in the.

SCHOOL OF ACCOUNTING AND BUSINESS BSc. (APPLIED ACCOUNTING) GENERAL / SPECIAL DEGREE PROGRAMME

setting up the business in sage

18.S096 Problem Set 5 Fall 2013 Volatility Modeling Due Date: 10/29/2013


Linear Programming for Portfolio Selection Based on Fuzzy Decision-Making Theory

Lecture 16 Investment, Time, and Risk (Basic issues in Finance)

Rafa l Kulik and Marc Raimondo. University of Ottawa and University of Sydney. Supplementary material

Correlation possibly the most important and least understood topic in finance

ECON 5350 Class Notes Maximum Likelihood Estimation


Section 3.3 Exercises Part A Simplify the following. 1. (3m 2 ) 5 2. x 7 x 11

Control Charts for Mean under Shrinkage Technique

Chapter Four Learning Objectives Valuing Monetary Payments Now and in the Future

0.07. i PV Qa Q Q i n. Chapter 3, Section 2

Chapter Four 1/15/2018. Learning Objectives. The Meaning of Interest Rates Future Value, Present Value, and Interest Rates Chapter 4, Part 1.

Chapter 4: Time Value of Money

CHAPTER 8: CONFIDENCE INTERVAL ESTIMATES for Means and Proportions

Where a business has two competing investment opportunities the one with the higher NPV should be selected.

0.1 Valuation Formula:

Bayes Estimator for Coefficient of Variation and Inverse Coefficient of Variation for the Normal Distribution

Forecasting bad debt losses using clustering algorithms and Markov chains

EVEN NUMBERED EXERCISES IN CHAPTER 4

A Technical Description of the STARS Efficiency Rating System Calculation

Productivity depending risk minimization of production activities

5 Statistical Inference

Non-Inferiority Logrank Tests

FOUNDATION ACTED COURSE (FAC)

Online appendices from The xva Challenge by Jon Gregory. APPENDIX 10A: Exposure and swaption analogy.

MA Lesson 11 Section 1.3. Solving Applied Problems with Linear Equations of one Variable

Faculdade de Economia da Universidade de Coimbra

Unbiased estimators Estimators

1 Estimating sensitivities

LESSON #66 - SEQUENCES COMMON CORE ALGEBRA II

Transcription:

Udergraduate Thesis MATHEMATICS DEGREE PORTFOLIO THEORY: MANAGING BIG DATA Author: Roberto Rafael Maura Rivero Tutors: Dra. Eulalia Nualart Ecoomics Departmet (Uiversity Pompeu Fabra) Dr. Josep Vives Mathematics ad Computer Sciece Departmet (Uiversity of Barceloa) Barceloa, 19th Jauary 2018

Cotets Itroductio 1 0.1 Project......................................... 1 0.2 Memory structure................................... 1 0.3 Ackowledgemets.................................. 1 1 previous otes 3 1.1 Goals of the models.................................. 3 1.1.1 Log ru ivestmets............................ 3 1.1.2 Huma behavioral - risk aversio..................... 4 1.2 Time complexity.................................... 4 1.2.1 Defiitios................................... 4 1.2.2 NP-hard algorithms whe P = NP..................... 5 2 Mai models ad hypothesis 7 2.1 Markowitz....................................... 7 2.1.1 First attempt solvig Markowitz...................... 8 2.1.2 Two ad oe fud Theorems........................ 9 2.1.3 Algorithm ad time complexity...................... 18 2.2 C.A.P.M......................................... 18 2.2.1 Further assumptios ad cosequeces:................. 19 2.2.2 Ivestors problem ad Oe ad Two fud theorems.......... 21 2.2.3 Critics..................................... 22 2.3 M.A.D.......................................... 23 2.3.1 Addig costraits............................. 26 2.4 Multiple Betas model ad aother extesios................... 27 2.4.1 Fama - Frech 3 factor model........................ 27 2.4.2 Proposed model: Clustered Betas model................. 29 3 IMPLEMENTATION OF THE MODELS IN PYTHON 31 3.1 MAD vs Markowitz.................................. 31 3.2 Test of our proposed model (cluster betas model)................ 37 i

4 CONCLUSIONS, NEXT STEPS AND CODE 39 4.1 Coclusios...................................... 39 4.2 Code.......................................... 40 Bibliography 49

0.1 Project Log ad extese is the literature of the portfolio theory. The mai goal of it is basically decidig which oe is the best possible ivestmet give a set of available assets. Durig the last decades, there has bee great improvemet i the way of dealig with the problem ad some fudametal chages i the hypothesis take. The mai issue that we will discuss here is that, so far, there is a trade off betwee the accuracy of the model ad the computatioal time complexity. I this work, we will discuss some of those famous models that have appeared durig history, its particular applicatio ad restrictios owadays, emphasizig i the computatioal problems derived whe workig with big data. After that, we will code some of the models ad compare them. Fially, we will propose oe ew model ad will compare it with the previous oes. 0.2 Memory structure The first chapter of this thesis is focused o give a few itroductory cocepts. I here, we will explai the reasos that justify the eed of low risk (stadard variatio) i the ivestmet world ad itroduce some computatioal complexity theory cocepts (P, NP, NP complete, NP hard). The secod chapter will focus directly o some of the most popular models throughout history. First we will explai the mai cocepts ad proof the some results i portfolio theory usig the Markowitz model (efficiet frotier, tagecy portfolio, Oe ad Two fud theorems). The we will preset the rest of the models ad we will solve the ivestors problem i each of them. We will fiish this chapter by presetig a ew proposed model that we have called Clustered Betas. I the third chapter, we will use real data ad Pytho code to check some of the results. Also, we will aswer questios raised i a research paper ([BW]) about closeess betwee MAD model ad Markowitz model. Fially, will check the accuracy of our proposed Clustered Betas model. I the forth ad last chapter, we will preset the coclusios of the thesis, ext steps ad the code used i chapter 3. 0.3 Ackowledgemets This thesis could ot have bee doe without the itervetio of may people. First of all, I would like to thaks my two tutors, Professor Eulàlia Nualart ad professor Josep Vives, for their grate help durig the realizatio of this work, the orietatio, the research

2 Itroductio material ad the hours valuable advice. I would also like to thak professor Robert F. Stambaugh from the Wharto School. His classes of fiace, the material he shared ad the umerous office hours i which he solved my questios ad queries have bee a great help i order to uderstad the topics of portfolio theory. Fially, I would like to thak both my family ad frieds for beig a great support durig this last year of college.

Chapter 1 Previous otes 1.1 Goals of the models First of all, I thik is ecessary to give a ituitive idea of why the goal of decreasig the variace of the portfolio is somethig importat. There are a few reasos that justify this, ad i this short space I am goig to explai 2 of them. 1.1.1 Log ru ivestmets First, we have to thik how the actual ivestmet works. Oce a ivestor buys a portfolio, the returs are usually reivested i the same portfolio. Therefore, we have to thik that, actually, we are makig ot oly 1 bet, but a series of cosecutive bets. We ca see that, if that is the case, give 2 ivestmets that are associated with a ormal distributio with the same average retur but differet variace, the expected retur at the ed of the day ca be much higher i the oe with lower variace. The typical example that is give to all udergraduates of fiace to iteralize this idea is the followig: Bet A-> 1/2 times you get 120% of your ivestmet ad 1/2 of the times you get 100% of your ivestmet Bet B-> You get 110% of your origial ivestmet for sure. If you compare the retur of obtaiig twice 110% (which gives you a retur of 121%) versus obtaiig 120% oce ad maitaiig 100% the ext period, it is very ituitive to see that bet B is better i the log ru. 3

4 previous otes 1.1.2 Huma behavioral - risk aversio Secodly, eve if we were speakig about ivestmets that take place durig oly oe period ad are thought for the short ru, umerous studies of huma behavior have cocluded that people i geeral, ad ivestors i particular, are risk averse. The defiitio of risk averse ivolves some orderig theory ad utility theory, ad it is ot the purpose of this work to explai this other ecoomic field, but ituitively, a ivestor is risk averse iff give ay 2 ivestmets with the same retur, she would prefer the oe with lower variace. This is studied i more deep i research about Utility Theory. Oe of the typical experimets (ad easier to do), is offer a radom sample of the populatio the optio of earig a certai quatity (e.g. 10 euro) or flip a coi ad get the double of that quatity oly i the case that the coi shows tails. Numerous research has show that people i geeral prefer the secure moey rather tha the fifty-fifty bet 1.2 Time complexity Durig this thesis, we will make costat refereces to the complexity of the algorithms used to solve the problems. I fact, the whole poit of the secod chapter of this thesis is comparig models that have bee appearig durig the last cetury i terms of accuracy ad time complexity. Therefore, I thik it is coveiet to let a few itroductory simple defiitios. Notice this defiitios are ot strictly formal ad serve just as a guide to uderstad posterior topics of this thesis. For more formal defiitios, please check [LE]. 1.2.1 Defiitios Defiitio 1.1. A complexity class is a set of problems that ca be solved by a abstract machie usig a O(f()) amout of a resource R, where is the size of the iput. Notice that the resource i this cotext is time, but i other cotexts could also mea space. Defiitio 1.2. P (for polyomial time) is the complexity class that cotais all decisio problems that ca be solved usig a polyomial amout of time by a determiistic Turig machie. Defiitio 1.3. NP (for odetermiistic polyomial time) is the complexity class that cotais all decisio problems for which the cases where the aswer is "true" have verifiable proofs i polyomial time by a determiistic Turig machie. Defiitio 1.4. NP-complete is the complexity class that cotais all decisio problems T such that T is i NP ad ay other problem U of the set NP ca be reduced to T i polyomial time. Defiitio 1.5. NP-hard is the complexity class that cotais all decisio problems V such that exists a NP-complete problem T such that T is reducible to V i polyomial time.

1.2 Time complexity 5 Iformally, oe ca say that the problem is NP-hard if it is least as hard as the hardest problems i NP. 1.2.2 NP-hard algorithms whe P = NP Durig the followig chapter, the reader will lear that some of the more accurate models (ie Markowitz M.V.) eed NP-hard algorithms to solve the ivestor problem (fid a optimal portfolio to ivest with a required average retur miimizig the risk). Notice that this meas it does ot matter i which of the two scearios, P=NP or P =NP, we are. Some of the models would still require too much time. For this reaso, some accuracy eeded to be sacrificed for the sake of fidig a solutio i a reasoable amout of time (P). We will discuss some of the most popular alog time. Oe of the first attempts to simplify it was the CAPM, but we advace that the lack of closeess to reality forced people to cotiue the search. Now a days, the most popular models are liear regressio models with a few umber of factors. This models are easy to compute, ad a lot of research is doe owadays focused i fidig the key factors with higher R-square ad statistical sigificace.

6 previous otes Figure 1.1: This image show the Euler diagram of the two possible scearios. Notice that eve i P=NP, a NP-hard problem will ot be solved faster.

Chapter 2 Mai models ad hypothesis 2.1 Markowitz The Markowitz model[ma] (also called the Mea Variace model or M-V model) assumes that the daily returs of ay of the asset of our uiverse of available assets {R i } i I (where I = {1,..., } ) is ormally distributed with stadard deviatio σ i := Var(R i ) ad average retur r i := E(R i ), ad that there is a certai correlatio σ ij betwee ay 2 asset i, j from our uiverse of shares I (ote σ i = σ ii ). The problem we wat to solve is the followig: give a miimum desired average retur ρ, we wat to ivest a quatity M 0 amog the differet asset i I, ivestig x i i each asset, sometimes up to a maximum of u j, which is the maximum moey a ivestor would place i a sigle assets, i a way such that we miimize the risk (variace) of the total ivestmet. To simplify the models, we will igore this last costrait. Further discussio of added costraits is explaied later. To sum up, the ivestors problem ca be described i the followig way [LU]: Miimize: Mi x ( i=1 j=1 σ ij x i x j ), (2.1) subject to ad x j r j ρm 0, (2.2) j=1 x j = M 0, (2.3) j=1 where x := (x 1,..., x ). 7

8 Mai models ad hypothesis I real life, traders ad ivestors may sell stocks that they do ot ow. This operatio is called short sellig. A summary of the real trasactio is the followig: the trader borrows a stock, he or she sells it immediately, ad buys oe agai later (after the price drops 10% the followig week for example). The, he or she returs this stock to the origial ower, who, of course, will get some iterests for the ledig. Notice i this model we allow short sellig, so a case i which i I such that x i < 0 is allowed. We ca restate the problem oce more, ormalizig it: Miimize: subject to ad Mi w ( i=1 j=1 σ ij w i w j ), (2.4) w j r j ρ, (2.5) j=1 w j = 1, j=1 (2.6) where w i = x i M 0. Now, we see clearly that the problem does ot deped o M 0, the quatity willig to ivest. 2.1.1 First attempt solvig Markowitz We will try to solve the problem usig Lagragia multipliers : L = 1 2 i=1 j=1 σ ij w i w j λ( i=1 w i r i ρ) µ( i=1 w i 1). After differetiatig it with respect to w i ad settig the derivatives equal to 0, we arrive to the followig: ad σ ij w i λr i µ = 0, i I, j=1 w i r i = ρ, i=1 (2.7) w i = 1. (2.8) i=1

2.1 Markowitz 9 The problem of equatios (2.7) is that there is ot a closed solutio i liear algebra. Therefore, i order to solve it,we have to use umerical aalysis. O a first look, kowig that we will fid computatioal complexity problems with those umerical methods, it might seem that fidig a buch of optimal portfolios for a sequece of ρ is goig to be a impossible task. However, there are some results that will make the work easier. I the followig lies we will prove that it is ot ecessary to calculate the solutio portfolio for every sigle ρ, ad that is eough to calculate it for just 2 differet ρ 1, ρ 2. The followig theorems ad proofs are take from [LU]. 2.1.2 Two ad oe fud Theorems Before statig the theorems of this subsectio, it is importat to itroduce a few ew cocepts. First of all, we will give a ame to those portfolios that solve our problem for a particular give ρ, ad the we will itroduce the cocept of the curve that represet all the solutios of the ivestor problem for ay ρ. Defiitio 2.1. (efficiet portfolio ) w = (w 1,..., w ) is a efficiet fud (or efficiet portfolio) iff ρ R such that w is the solutio of problem (2.4). Notatio: from ow o, we might use the otatio w(ρ) to refer to the vector solutio of problem (2.4) for a give ρ. Defiitio 2.2. (efficiet frotier ) If {R i } are all risky ivestmets (ie σ i > 0 i I) ad R := (R 1,..., R ), the, we defie the efficiet frotier (or the efficiet portfolio set) as EF := {(ρ, Var(w(ρ) R)) R 2 }, where w(ρ) R = Σ i=1 w(ρ) ir i This set of solutios (the efficiet frotier), defies ideed a curve i R 2. To give a idea of how the graph of the efficiet frotier looks like, we show i 2.1 a plot of the efficiet frotier of radom geerated portfolios with a buch of poits that represet the idividual stocks. I order to uderstad how it is geerated, we will describe the characteristics of the efficiet frotier i the case of portfolios geerated by 2 assets. Take two assets i, j from our set of assets I. If the assets are perfectly correlated (ie σ ij = 1), the, the stadard deviatio of ay portfolio p = (w, 1 w) (ie ivestig w i portfolio i ad 1 w i portfolio j) geerated by combiig the 2 assets, has the followig variace: σ 2 p = w 2 σ 2 i + (1 w) 2 σ 2 j + 2w(1 w)σ i σ j = [wσ i + (1 w)σ j ] 2

10 Mai models ad hypothesis Figure 2.1: Plot of the efficiet frotier (i yellow) of radomly geerated stocks (blue dots). The, the stadard deviatio is the followig: σ p = w i σ i + (1 w i )σ j Therefore, the feasible portfolios are described by a segmet, as show i 2.2 (otice the Y axis idicates the expected retur of the portfolio E ad the X axis idicates the stadard deviatio of the portfolio σ ). If, istead, the assets are completely ucorrelated (σ ij = 1), the: σ 2 p = w 2 σ 2 i + (1 w) 2 σ 2 j 2w(1 w)σ i σ j = [wσ i (1 w)σ j ] 2 The, the stadard deviatio is the followig: σ p = w i σ i (1 w i )σ j ad the graph of the possible portfolios that are combiatios of the portfolios i, j is like the oe i the image 2.3.

2.1 Markowitz 11 Figure 2.2: Graph of all feasible portfolios geerated by 2 perfectly correlated assets. Notice that, if this is the case, it is possible to obtai a risk free portfolio by ivestig a quatity w = σ j /(σ i + σ j ). Doig this, oe would ed up with the portfolio that has stadard deviatio = 0 (the poit i the curve of 2.3 that is taget to the Y axis. I the previous case of perfect correlatio, it is also possible to do so, but oly by doig short sellig oe of the assets. It is ow ituitive to imagie the geeral case, where the stadard deviatio is the followig: σ p = w 2 σi 2 + (1 w) 2 σj 2 2w(1 w)σ ij. The curve will lie betwee the boudaries of the previous extreme cases, give a image like 2.4. I the geeral case, with 3 or more liearly idepedet assets, the set of feasible portfolios stops beig just a lie or a curve, ad ca be represeted by a covex set ( 2.5). Now, we will explai how the theory chages whe we itroduce a particularly curious asset: the risk-free asset. As is ame states, this asset has stadard deviatio equal to 0. Now we are goig to itroduce the cocept of tagecy portfolio. Ituitively it is easy to uderstad lookig at 2.6. To fid it, we draw the efficiet frotier of the uiverse of assets I. If we add R f to that uiverse, the, give that the risk free asset is ucorrelated to ay other asset i I, the ew efficiet frotier ca be draw by just a lie with the poit (0, R f ) of the graph ad taget to the EF i the highest possible poit. A more formal defiitio is preseted i the followig lies. Defiitio 2.3. (tagecy portfolio) If {R i } i I are all risk ivestmets (ie σ i > 0 i I), EF({R i } i I ) is its efficiet frotier of {R i } i I, ad R f is a risk-free asset, the we will call tagecy portfolio to the itersectio of both efficiet frotiers with ad without the Risk Free asset:

12 Mai models ad hypothesis Figure 2.3: The lie represet all feasible portfolios geerated by 2 perfectly egatively correlated assets. EF({R i } i I {R f }) EF({R i } i I ). If we assume that the behavior of the assets is exactly as predicted by the models, the we have the followig 2 results: Theorem 2.4. (Two fud theorem) ρ 1, ρ 2 (ρ 1 = ρ 2 ) the w := t w(ρ 1 ) + (1 t) w(ρ 2 ) is ad efficiet portfolio of expected rate of retur (tρ 1 + (1 t)ρ 2 ). Proof. It is eough to check that, if the first 2 portfolios fit ito the +2 liear equatios of 2.7, the w will also fit. Let s recall the equatios ad Let s take λ 1, µ 1, λ 2, µ 2 from the solutios of ρ 1, ρ 2 σ ij w i λr i µ = 0, i I, (2.9) j=1 w i r i = ρ, (2.10) i=1 w i = 1. (2.11) i=1

2.1 Markowitz 13 Figure 2.4: This is how the graph looks if the 2 assets are ot perfectly egatively or positively correlated.

14 Mai models ad hypothesis Figure 2.5: The EF is the top part of the frotier of the covex set of all feasible portfolios j=1 σ ijw i λr i µ = 0, i I, i=1 w ir i = i=1 tw(ρ1 ) i r i + (1 t)w(ρ 2 ) i r i = t( i=1 w(ρ1 ) i r i ) + (1 t)( i=1 w(ρ2 ) i r i ) = tρ 1 + (1 t)ρ 2 i=1 w i = i=1 t w(ρ1 ) i + (1 t) w(ρ 2 ) i = 1. Fially, otice that, sice the 2 solutios make the left side of the equatio 2.9 equal to 0, the (w, λ 3, µ 3 ) := (w, tλ 1 + (1 t)λ 2, tµ 1 + (1 t)µ 2 )

2.1 Markowitz 15 Figure 2.6: New EF with a risk free portfolio ad fidig the taget portfolio. is also a solutio of equatio 2.9. Notice that, as we allow short sellig, t ca be ay real umber. Kowig this result, it is trivial to see that with oly 2 differet efficiet portfolios we ca geerate the etire efficiet frotier. Despite the easy proof of this result, the implicatios of this i the real world are huge ad agaist the ormal ituitio. Broadly, this meas that i a ideal world, all the ivestors oly have to decide to ivest betwee two fuds (portfolios), ad the oly thig they have to do depedig o their required miimum average retur is to chage the proportio ivested i each oe. Theorem 2.5. (Oe fud theorem) If there is a risk free asset R f (i.e., a asset of costat daily retur ad variace equals to 0) i our uiverse of assets, the!f portfolio of risky assets s.t. w EF( t R(w = tf + (1 t)r f ). Note: i case the reader is woderig if such a asset exists i the real uiverse of assets, a bod is always give as a good example of what is cosidered i real life as a asset without risk. Proof. The proof will first show uity of the previously defied "tagecy portfolio". This tagecy portfolio is F, ideed. The, the property that w EF( t R(w = tf + (1 t)r f ) will be derived from the 2 fud theorem.

16 Mai models ad hypothesis Now, we will describe the process to fid the taget fud. It is obvious that, what we have to do ow is maximize taθ w = r f r(w) σ(w) = i=1 w i(r i r f ) j=1 i=1 σ ijw i w j, where r(w) ad σ(w) are the retur ad stadard deviatio of the portfolio associated at the vector w = (w 1,..., w ). We the set all the derivatives of taθ with respect to w i equal to zero for all i I. Therefore, we have the followig expressios with λ as a ukow costats: σ ij λw i = r j r f, j I. i=1 Now we substitute v i = λw i for each i, ad the equatio becomes: σ ij v i = r j r f, j I. i=1 Now we oly have to solve this liear equatios for the v i s, ad we arrive to v i w i = k=1 v k ([LU], 168) Summarizig ad restatig, the fud F = (w 1,..., w ) is the taget fud ad the w i are give characterized i the followig way: v i w i = k=1 v, i {1,..., }. k Where (v 1,..., v ) is the solutio to the set of liear equatios σ ij v i = r j r f, j I. i=1 With this we have foud the taget portfolio. We ow eed to kow which is the proportio that we eed to ivest i the risk free portfolio ad which oe i the taget portfolio i order to solve our problem (ie obtai a portfolio of retur equals to ρ). I order to do so, we oly have to calculate the average retur of the risky portfolio, which is r F = i=1 x ir i. Now, we have to fid the proportio t by solvig the followig equatio: ρ = r f t + (1 t)r F. I order ot to complicate the theory with techical details, the literature cosiders that you ca short sell ad buy risk free assets with the same retur. Otherwise, we would have to chage some of the defiitios, ad every time we speak about optimal portfolios, we would have to do it by usig piecewise defied fuctios (check 2.7). It is remarkable that the previous 2 theorems have i aalogous results i the rest of models preseted i this thesis.

2.1 Markowitz 17 Figure 2.7: This is how the EF would look with a borrowig iterest differet from the ledig iterest

18 Mai models ad hypothesis 2.1.3 Algorithm ad time complexity Despite of the Two fud theorem ad the Oe fud theorem, the stated problem of solvig so far is solved with a process of quadratic programmig. Quadratic programig is the process of solvig a problem of optimizatio (ie maximizatio or miimizatio) of a quadratic fuctio of a certai set of variables subject to a certai set of costrais that are liear. Usig matrix otatio it ca be formulated as follows: miimize x Px + q x, subject to Gx h, ad Ax = b where x, q are -dimesioal vectors, b is a m - dimesioal vector, h is a l - dimesioal vector, A is a m matrix, P is a matrix, G is a l matrix, for certai l, m, N. We kow that this particular problem has a polyomial worst case complexity. I posteriors ad more refied variatios of this model, some restrictios are added i order to take ito accout for the price of the trasactios ad other details that will be discussed later i this thesis. This icreases eve more the complexity of the program (oe example is the Limited Asset Markowitz model - LAM -, which falls ito the class of the NP-hard problems [CST]). This illustrates the mai problem whe dealig with Big Data: if the umber of assets is large eough, the the model of Markowitz (with the ecessary added costraits for the particular case of study) is useless i real life because of its time complexity. For that reaso, ew models had to be created to deal with this problem. Whe ivestors wat to use the Markowitz, what is doe so far is solvig (2.4) for two differet ρ with certai software specifically desiged for covex optimizatio. After that, fidig ay ew solutio is trivial thaks to the 1 ad 2 fud theorem. 2.2 C.A.P.M. The Capital Asset Pricig Model was itroduced i the 60 s by differet authors idepedetly [F], as it is a easy ad ituitive simplificatio of the Markowitz model. The CAPM is a model that, as the Markowitz, assumes that each asset behaves as a ormal distributio. However, i this model, the assets are ot correlated amog themselves as they were i the Markowitz Model. Istead, all assets are a liear regressio of oe sigle asset. This gets rid of the computatioal problem that represeted dealig with a etire matrix of correlatios.

2.2 C.A.P.M. 19 The ew model assumes that each asset is a liear regressio of "the overall market". This overall market is represeted i the model by a particular asset that is called "the market portfolio". This is a portfolio formed by a weighted sum of all assets of our uiverse, with the same weights that they represet i the market, assumig that this assets are ifiitely divisible. This theoretical cocept is formed by ANY asset with value i our uiverse, which icludes all stocks from all markets, all kids of real state, precious metals or eve stamps. However, whe this model is implemeted, drivers are eeded to represet the overall market for obvious reasos, ad at the ed of the day, people use differet idex like the S&P500 as the estimators of the market portfolio. The otatio is the followig: We have a uiverse of assets {R i } i I where I = {1,..., } plus 2 particular assets called the "risk free asset" R f (this represets a asset like bods, that have a fixed retur ad are cosidered free of risk i geeral) ad the "market portfolio" R m R m behaves as a ormal distributio s.t. σ m := var(r m ) ad r m := E(R m ) R f behaves as a ormal distributio s.t. σ f := var(r f ) = 0 ad r f := E(R f ) (abusig a bit of the otatio, people usually say E(R f ) = R f ) For every asset R i α i, β i R s.t. the followig equality holds: R i R f = α i + β i (R m R f ) + ɛ i where ɛ i is a ormal distributio with E(ɛ i ) = 0 ad a certai variace σ i (this ɛ i adds to the model what we call "the idiosycratic risk"). i, j(i = j) the covariace(ɛ i, ɛ j ) = 0 Fixig our attetio i the risk free asset ad the market portfolio, otice that α m = 0, β m = 1 ad that α f = R f (= E(R f )), β f = 0. Now, it is easy to deduce the followig formulas: Expected retur of ay asset i : E(R i ) R f = α i + β i (E(R m ) R f ) Variace of ay asset i : σ 2 i = β 2 i σ2 m + σ 2 (ɛ i ) 2.2.1 Further assumptios ad cosequeces: All ivestors [A]: Aim to maximize ecoomic utilities (asset quatities are give ad fixed). Are ratioal ad risk-averse. Are broadly diversified across a rage of ivestmets. Are price takers, i.e., they caot ifluece prices. Ca led ad borrow ulimited amouts uder the risk free rate of iterest.

20 Mai models ad hypothesis Trade without trasactio or taxatio costs. Deal with securities that are all highly divisible ito small parcels (All assets are perfectly divisible ad liquid). Have homogeeous expectatios. Assume all iformatio is available at the same time to all ivestors. This model with this assumptios helps us to uderstad i later aalysis why α is really close to 0 i most of the stocks. To formally uderstad why, some Utility Theory is ivolved. The idea of the explaatio is that, if a stock has a positive α, the the ivestors would buy it, because it icreases its utility (he cosiders that combiig the stock with a certai portfolio, the icrease i risk is compesated by the icrease i expected retur). This is because she ca maitai the positive alpha while decreasig the risk by shortig a certai quatity of market portfolio, ad diversifyig with the risk-free portfolio to get rid of some idiosycratic risk. To sum up, at the ed of the day, there is a higher demad of portfolios/stocks with α > 0, ad this icreases the price, decreasig later returs ad decreasig the α to 0. Oe of the queries the reader might have right ow is that, despite that this models assumes some properties for the idividual assets (the existece of α ad β), maybe this properties are ot iherited by the portfolios. Thus, we preset the followig lemma to prove that ay portfolio p fit perfectly ito the model, havig ideed a characteristic α p ad β p. Lemma 2.6. For ay portfolio p that is a combiatio of {R 1...R, R m, R f }, α p, β p R st (R p R f = α p + β p R m + ɛ p ) where ɛ i is a ormal distributio with E(ɛ i ) = 0 Proof. It is eough to prove it for the simple portfolio formed by 2 differet assets (i, j). Check that if R p = wr i + (1 w)r j the, α p = wα i + (1 w)α j β p = wβ i + (1 w)β j ɛ p = wɛ i + (1 w)ɛ j Notice that ɛ p is a ormal distributio because is the sum of ormal distributios. Also E(ɛ p ) = E(wɛ i + (1 w)ɛ j ) = we(ɛ i ) + (1 w)e(ɛ j ) = 0 + 0 Now we ca use i ay portfolio the same otatio that we used oly for the idividual assets. From here, we ca deduce that, i the geeral case, if we ivest x = (x 1,..., x, x m, x f ), the:

2.2 C.A.P.M. 21 E(R p ) R f = x α + x β(e(r m ) R f ) σ 2 (R p ) = (x β) 2 σ 2 m + x σ 2 (ɛ) where α = (α 1,..., α, 0, R f ), β = (β 1,..., β, 1, 0) ad σ 2 (ɛ) = (σ 2 (ɛ 1 ),..., σ 2 (ɛ ), σ 2 m, 0) 2.2.2 Ivestors problem ad Oe ad Two fud theorems Agai, we wat to solve the followig problem: give a desired miimum retur ρ, we wat a vector x that represets the portfolio that has a expected retur of at least ρ ad a the miimum possible variace. Miimize: Mi x (σ 2 (R p ) = (x β) 2 σ 2 m + x σ 2 (ɛ)) (2.12) subject to x j r j ρ j=1 x j = 1 j=1 (2.13) where x := (x 1,..., x ). Notice that, from here, we ca deduce agai the oe fud ad two fud theorem with a aalogous proof ad similar (if ot equal) defiitios of the previous cocepts. Because of the legth costrait, we will omit the proof here ad i the rest of the models. The mai differece ow is that the approach of this problem ca be solved with a liear programig process by rewritig σ 2 (R p ) = (x β) 2 σ 2 m + x σ 2 (ɛ) = x (β 2 σ 2 m + σ 2 (ɛ)). Liear programs are problems that ca be expressed i the followig way: miimize subject to ad c x, Ax = b Gx h. Thaks to Leoid Khachiya [Kh], sice 1979 it is kow that this kid of problems ca be solved i polyomial time. Therefore, this model solves the Markowitz issue with the complexity.

22 Mai models ad hypothesis 2.2.3 Critics The mai problem of this model is its lack of accuracy. I latter aalysis, we will see that, despite that this model has o computatioal complexity problems, it has a low R- square whe aalyzig stocks ad portfolios. The R-square, represeted by β2 i Var(R m), is Var(R i ) the part of the variace that is explaied by the predictio of the model. Moreover, further discussio has bee made about if the ecessary assumptios of the model are actually true. Just to give a quick overview of some of the problems, we refer to the 2004 Fama ad Frech review of the model [FF]: The stocks do ot behave exactly as ormal distributios (see problems with fat tails) The model assumes all the potetial shareholders have access to the same iformatio ad agree i all the iformatio of ay asset The model assumes that the iformatio obtaied by the shareholdes is true It assumes risk aversio of the ivestors. Discussio has bee made about the possible existece of stock traders - casio gamblers like (ie, risk seekig ivestors) There are trasactio costs ad taxes, which are ot take ito accout by the model If the ivestor is big eough, his order of buyig/sellig could cause a variatio i the price of the stock. Agai, this is ot cosidered i the model. Stocks are ot ifiite idivisible. You may ot be able to buy half a share. CAPM may ot be empirically testable because of the defiitio of market portfolio. Empirical tests show market aomalies like the size ad value effect that caot be explaied by the CAPM. This are later icluded i variatios of the model like FF3factor model. Notice that some of the assumptios are also made i the Markowitz model. As the reader might deduce from previous commets, this problems are tried to be solved i more detailed posterior models. Despite that it is ot the goal of this thesis to discuss them because of the extesive umber of more detailed models, we ecourage to check more precise versios of the models here preseted that take ito accout differet added restrictios (see as oe example [CST] ). Despite the stated problems, CAPM is still taught ad used ow a days for various reasos. First of all, it is easy to uderstad ad maipulate. Therefore, i fiace courses of may busiess schools, this is use to give a first approach ad the mai ituitive ideas of the market. Secodly, whe baks ad other istitutios explai to their ivestors the mai characteristics of their fiacial products, they usually describe them focusig o the "high alphas ad low betas". This is because may of the future buyers of the products do ot seek to eter i complicated calculatios. May people eve rely o more aive aalysis of the assets based o a simple rate (see Moody s, Stadad & Poors or Fitch ratig tiers).

2.3 M.A.D. 23 2.3 M.A.D. M.A.D. is aother alterative to Markowitz M-V model. It was first proposed by Koo ad Yamazaki i 1992 [KY], ad i this model, the ormality of the stock returs is ot assumed. Usig this approach, the cocept of risk is reflected by aother driver differet from the variace or the stadard deviatio: the mea absolute deviatio ( MAD = E[ R p r p ], where r p is the expected retur of the portfolio E(R p ) ). First of all, we will start with oe of the first results of the paper i which this model was preseted: Theorem 2.7. If A = {R 1,..., R } are multivariate ormally distributed, the, for all portfolio R p = Σ i=1 x ir i combiatio of the uiverse of assets A : E[ R p r p ] = where σ(r p ) is the stadard deviatio of the portfolio. 2 π σ(r p), Proof. Let (r 1,..., r ) be the meas of (R 1,..., R ) ad also let (σ ij ) R be the covariace matrix of (R 1,..., R ). The i=1 x ir i is ormally distributed [R] with mea i=1 x ir i ad stadard deviatio Therefore, E[ R p r p ] = σ(r p ) = 1 2πσ(Rp ) i=1 j=1 σ ij x i x j. u2 u exp{ 2σ 2 (R p ) du} = 2 π σ(r p). The implicatios of this simple result are strog. This little theorem has just prove that if we are i the case i which the behavior of the portfolios is actually a ormal distributio (which, agai, is ot assumed i this model), usig either MAD or the stadard deviatio as a measure of risk (ie, solvig the ivestors problem usig the Markowitz model or the MAD model) is equivalet. However, we have to be careful here. This does ot mea that usig either model to solve the ivestor problem will give us the same solutio. This is because, as the reader might have already deduce, the stocks do ot behave exactly as ormal distributios. Therefore, despite that we expect the results to be close, they might be differet, as we will check later. Now, the otatio that we will use i this chapter is the followig: {R 1,..., R } is the uiverse of assets, that do ot ecessary behave as ormal distributios.

24 Mai models ad hypothesis T = {1,..., T} time horizo. r jt is the retur of the asset j at time t (ie is the realizatio of the radom variable R j durig period t ). r j = (Σ T t=1 r jt)/t. x j moey ivested i asset j. Now, the ivestors problem will be restated with the ew risk measure i the followig way: Miimize: Mi x (E[ R p r p ]), (2.14) subject to Σ j=1 x jr j ρ, (2.15) ad Σ j=1 x j = 1. (2.16) Whe this model is implemeted, T t=1 r jt/t is used as a estimator of E(R j ). Therefore, the problem that we are ow facig is the followig: Miimize: Mi x ( T t=1 j=1 x j (r jt r j ) ) 1 T, (2.17) subject to ad x j r j ρ, (2.18) j=1 x j = 1, (2.19) j=1 where r j = T t=1 r jt/t. Now, with oly a few adjustmets, we ca state the problem i a way such that is solvable by liear programmig process. Let us deote: a jt = r j t r j. The, we have: Miimize: Mi x ( T t=1 j=1 x j a jt 1 T ) (2.20)

2.3 M.A.D. 25 subject to x j r j ρ j=1 x j = 1 j=1 Which is equivalet to the followig: Miimize: (2.21) subject to y t + y t j=1 j=1 x j r j ρ, j=1 x j = 1. j=1 Mi x,y ( T t=1 y t 1 T ) (2.22) x j a jt 0, t = 1,..., T, x j a jt 0, t = 1,..., T, (2.23) Note that, agai, this formulatio lacks a aalytical solutio. However, ulike the Markowitz problem, we ca solve this by liear programmig process. Some of the differeces betwee this model ad the Markowitz model, already eumerated i the paper of the first appearace of MAD, are the followig [KY]: It is ot ecessary to operate with a covariace matrix. This also facilitates the update of the model every period. This is importat because whe we ivest, we should cosider that the cotext of the market may vary, ad therefore, we should balace the portfolio every ow ad the to cofrot those chages. Havig to calculate the covariace matrix i eviromets costatly with so may data ca be a problem. The liear problem is much easy to solve. Moreover, otice that the umber of costraits here is costat (to be precise, it is 2T + 2) regardless the umber of stocks. Therefore, it is feasible to solve this problem with thousads of stocks i a acceptable amout of time. The optimal solutio of the MAD problem cotais at most 2T+2 positive ivestmets. Therefore, our portfolio will ever have more tha 2T+2 assets, o matter how big the uiverse of stocks is (ie ). This allows ivestors to use T as a cotrol variable. As already metioed, there are other costraits i real life that are ot discussed i this paper, that have to be take ito accout whe doig real ivestmets, ad oe of those might be the umber of differet stocks i which someoe is willig to ivest.

26 Mai models ad hypothesis Notice that, agai, with a aalogous proof that we will omit, the Oe ad Two fud theorems hold as true i this model (but with a graph where the the x-axis represet the value of the MAD istead of the stadard deviatio of every asset ad portfolio). 2.3.1 Addig costraits It is kow that this models preseted here are just a simplificatio of the real life. I fact, the costraits give are ot the oly oes that traders ad ivestors face whe makig a decisios. There are some issues like legal problems (sometimes the exposure to certai assets or the level of leverage ad debt is ot allowed), the idivisibility of oe uit of stocks (i geeral, you ca ot buy, for example, 10 7 stocks) amog may others. At the ed of the day, the importat thik is how this costraits will affect the feasibility of the achievemet of a solutio i a reasoable time whe we are dealig with big data. I the followig lies, we will preset 2 very simple costraits that are i fact real i may cases. The we will evaluate how this affects the computatioal complexity (all of the followig ad further deeper aalysis is developed i [CST]). Cardiality costrait: o more tha K differet assets should be held i the portfolio. Quatity costrait: the quatity x i of each asset that is icluded i the portfolio has to be i a give iterval [l i, u i ] (also called "buy-i threshold"). If we add just this reasoable restrictios (cardiality ad quatity costraits), suddely it turs out our problem is much more complicated, computatioally speakig. The problem usig the MAD model would look like the followig: Miimize: Mi x,y ( T t=1 1 y t ), (2.24) T

2.4 Multiple Betas model ad aother extesios 27 subject to ad y t + y t j=1 j=1 x j r j ρ, j=1 x j = 1, j=1 y j K, j=1 x j a jt 0, t = 1,..., T, x j a jt 0, t = 1,..., T, l i y i x j u i y j, j I y j {0, 1} (2.25) d j 0. (2.26) This problem has to be solved by Mixed Iteger Liear Programig [SEW], ad therefore, it falls ito the class of NP-hard problems. Agai, we face the impossibility of usig this model whe dealig with big data because of the complexity whe more costraits are added. 2.4 Multiple Betas model ad aother extesios The Multiple Beta models is a family of simple extesios of the CAPM model. Still, the accuracy is much higher. However, that does ot mea we have the computatioal problems that we foud i the Markowitz model. I those models, we are doig agai a liear regressio, but istead of oly doig it with 1 factor (the market portfolio R m ), we will defie more factors. There are plety of variatios ad versios of this idea. Some of the most popular are the Fama-Frech 3 factor model (which we will describe below) or the Carhart four-factor model. Give that all are fairly similar, we are goig to focus oly o the first oe (FF 3 factor). 2.4.1 Fama - Frech 3 factor model This model was created by two professors from the Uiversity of Chicago: Eugee Fama ad Keeth Frech. This was oe of the most popular models whe dealig with big data i the stock market, because of its simplicity ad accuracy. Now a days, the models used are small variatios of it, usually addig ew factors like mometum. The 3 factors that are used i this model are the followig

28 Mai models ad hypothesis 1. Market: this factor represets the same as it did i the CAPM model. It is the retur of the market portfolio. 2. SMB (Small -market capitalizatio - Mius Big) 3. HML (High -book to market ratio - Mius Low) Now we are goig to give a small explaatio of what are they supposed to represet ad how they are estimated. I the followig lies, we will itroduce ew cocepts like market capitalizatios ad book to market ratio. Market capitalizatio := umber of shares of the compay price of every share. Book to market ratio := (A B) C, where A = sum of the value of all the assets of the compay, B = sum of the value of all liabilities, C = market capitalizatio. Note that (A B) = value of the compay accordig to the accoutacy. Whe people wat to differetiate the stocks depedig o their market capitalizatio, they usually refer to them as low cap, mid cap ad small cap. Whe people wat to differetiate stocks depedig o their book to market ratio, they usually use the cocepts of growth stock (stock with low BTM ratio. BTM< 1) ad value stock(stock with high BTM ratio. BTM 1). Now we are goig to explai a bit the reaso of the selectio of the ew two factors (SMB, HML) for the regressio ad ways of estimatig them: SMB (small -market capitalizatio - mius big): Empirically, it has bee observed that the returs of stocks of compaies with small market capitalizatio are higher, maitaiig other criteria costat. The literature has foud a few reasos justifyig this, like the less risk of big compaies to fail i market crashes, or the overvaluatio of famous big compaies (ivestors like to buy shares of Apple or Google just because they are famous). Oe simple ad aive driver of this factor would be a portfolio that, after reorderig all shares i the market depedig o their market capitalizatio, logs the top 10% of those compaies ad shorts the bottom 10%. HML (high -book to market ratio - mius low): Agai, empirically, it has bee see that those compaies with high book to market ratio perform better tha others. Some reasos that have bee foud as origi of this are agai the overvaluatio of famous compaies (usually, compaies i the IT sector have most of their valuatio based o itagible). Moreover, i geeral, the performace of growth stocks, whe is positive, it outperforms value stocks, which perform cosistetly better i the log ru, but with

2.4 Multiple Betas model ad aother extesios 29 lower ad more stabilized returs. This causes the so called rececy effect (people buy stocks based o recet returs, igorig the log ru), causig agai a overvaluatio of the growth compaies ad a udervaluatio of the value compaies. Oe simple ad aive driver of this factor would be a portfolio that, after reorderig all shares i the market depedig o their book to market ratio, logs the top 10% of those compaies ad shorts the bottom 10%. The otatio ad assumptios i this model are the followig: We have a uiverse of assets {R i } i I where I = {1,..., } plus 4 particular assets called the "risk free asset" R f (this represets a asset like bods, that have a fixed retur ad are cosidered free of risk i geeral), the "market portfolio" R m, the "growth portfolio" R g, ad the "value portfolio" R v. R k behaves as a ormal distributio s.t. {v, g, m, f }. σ k := var(r k ) ad r k := E(R k ) for k For every asset R i α i, β m i, β v i, βg i R s.t. the followig equality holds: R i R f = α i + β m i (R m R f ) + β v i R v + β g i R g + ɛ i, where ɛ i is a ormal distributio with E(ɛ i ) = 0 ad a certai variace σ i (this ɛ i adds to the model what we call "the idiosycratic risk"). i, j(i = j) the covariace(ɛ i, ɛ j ) = 0. Trivially, all the importat results ad coclusios explaied i the CAPM model are true here. The problem of the ivestor is still a liear programig solvable (therefore, the algorithm to solve it has a polyomial time complexity), but ow, oly by addig this 2 ew factors, the accuracy of the model whe used i real life is much higher whe dealig with diversified portfolios ad fuds. The Oe ad Two fud theorems also hold true i this model. 2.4.2 Proposed model: Clustered Betas model Durig the study of the models with oticed the followig: if the assets truly behave as certai distributios, the it should t be ecessary to check iformatio from outside the historical returs. Theoretically, from the historical itself, oe should be able to determie which is the distributio that the stock is followig. Accordig to this idea, it should ot be ecessary to check for iformatio like the umber of share, the value of the compay i the accoutacy or the idex S&P500 to uderstad the distributio of ay give stock. Moreover, i the multiple beta model, as i CAPM model, the model proposes the factors to use before startig the regressio. I our proposal, we will geerate "factors portfolios" with the iformatio of the historical itself, ad othig else. A factor portfolio will just be a hypothetical portfolio of assets that share a characteristic that cause a

30 Mai models ad hypothesis high correlatio amog them (e.g. it could be their geographical situatio or the fact that they are operatig i the same sector). Still, the oly criteria to create those factors is that they are highly correlated ad we do ot eed to check if they ideed have somethig i commo. The curious thig about our proposal is that we might idetify factors that otherwise we would have ever idetified, that are impossible to see uless oe checks for the historical returs of the assets, or that eve after beig idetified we do ot uderstad. The factors also will be particularly specific for every market. Moreover, this way of creatig the factors ca be used i markets outside the stock market (like commodities), i which other multiple beta factors like the Fama Frech do ot fit because of a selectio of the factors specifically for shares of compaies. We propose the followig algorithm to put these ideas i practice: 1. First of all, we have to defie a umber c [0, 1] that represets the absolute value of what we will cosider a high correlatio, ad k the umber of factors we wat to use. I our implemetatio, we take as c = percetile 97.5 of all the correlatios amog all assets, ad k = 3, imitatig FF3factor. Notice that this is just oe approach to select what we cosider a fair umber of factors ad a high correlatio, but differet criteria ca be use to choose c ad k. 2. Defie m = 0 3. For all i I we set S i := {i I : σ ij c}). This set represets a factor, so we have oe factor for each stock. Now we have #I factors, which are too much to do a regressio (we oly eed k). We will use oly the best factor i the followig step. Notice this set cotais similar stocks, i the sese that all elemets of ay set S i are highly correlated with stock i. 4. Take the set S i with higher umber of elemets. This will be a factor. Now we will create the followig portfolio as a estimator of S i : ivest +1$ i each stock j J s.t. σ ij > 0 ad shortsell -1$ i each stock j J s.t. σ ij < 0. Call this portfolio F m. If you have doe this k times (ie m = k 1), cotiue to step 5. Otherwise, we reame I := I\S i, m = m + 1 ad retur to step 3. 5. Do a OLS liear regressio with the k 1 "factor portfolios" F 1,..., F k 1 ad the "market portfolio" to fid α, β 1,..., β k 1, β M.

Chapter 3 IMPLEMENTATION OF THE MODELS IN PYTHON I the followig lies, we are goig to explai some experimetal comparisos that are doe with the models, i order to have a more practical view of the differeces betwee them ad a reflex of the problems ad results that were predicted i the theory previously. 3.1 MAD vs Markowitz I the followig lies, we are goig the optimal portfolios calculated by 2 differet programs for very differet cotexts. As iput, we will give the historical of stocks of the US Market. All of them will be part of the S&P100, but we will check the results i differet dates ad with differet quatities of stocks. The data was extracted from the webpage www.quatopia.com, which has proved to be a extremely useful tool durig the realizatio of this thesis to fid code implemetig strategies, historical data of the US stocks market ad discussios about fiace topics. Before startig the aalysis, I would like to refer to results obtaied i previous research by other authors([bw], [KY]). I the origial paper where the MAD model was preseted [KY], they compared its results with 224 icluded i NIKKEI 225 idex. I their paper, they showed that for that specific data, the portfolios obtaied for oe or the other method were quite similar. I particular, the differece of the portfolios i the stadar deviatio was at most a 10 % of the value of ρ (so apparetly the accuracy of the replace depeds o the demaded miimum average retur). I the studies of [BW], they compared 30 portfolios cosistig of five stocks ad a six-moth bod by radomly selectig the stocks from the S&P 500. Roughly, their paper 31

32 IMPLEMENTATION OF THE MODELS IN PYTHON coclude that, for a small quatity of stocks, the two models (MAD ad Markowitz) give similar results. Case with 5 stocks First of all, we should kow some iformatio about the daily returs of the S&P100 to have a bit of backgroud. For this reaso, I itroduce this table with the average daily retur of the differet percetiles of the stocks from the S&P100: percetile 10-1.09% percetile 20-0.62% percetile 30-0.35% percetile 40-0.13% percetile 50 0.05% percetile 60 0.24% percetile 70 0.46% percetile 80 0.76% percetile 90 1.26% Therefore, ow we kow that 50% of the stocks produce at least a average daily retur of 0.05%, ad that oly the top 10% of the stocks have a average daily retur higher tha 1.26%. Some other iterestig facts are the followig: the average daily retur from all the stocks is 0.06%, the miimum daily retur was -16%, the maximum was +11% ad the variace was 1.15%. The followig results have bee obtaied usig the closig price of the daily returs of the followig stocks: "AAPL", Apple Ic., Tech compay "AMZN", Amazo.com, Ic., electroic commerce "GOOG", Alphabet Ic Class C (GOOGLE), Tech compay "GS", Goldma Sachs Group Ic, fiacial services "JPM", JPMorga Chase & Co., fiacial services start date="2016-07-01" - ed date="2017-08-01" I the image 3.1 we ca see the blue dots represetig the 5 stocks. I yellow color the efficiet frotier give by the MV model, ad i red the efficiet frotier give by the MAD model. Obviously, the frotier give by the MV model is the oe more to the left. It looks like they are really close i all tested values. We have calculated the optimal portfolios of both MAD ad Markowitz usig the data betwee "2016-07-01" ad "2017-08-01" with differet miimum expected average retur requiremets (ρ). After that, we have checked the daily performace of those 2 portfolios