AMS-511 Foundations of Quantitative Finance
Fall 2018 — Workshop — Due Monday 2018-12-10
Examining the CAPM Against Actual Data
Robert J. Frey, Research Professor
Stony Brook University, Applied Mathematics and Statistics
Robert.Frey@StonyBrook.edu http://www.ams.sunysb.edu/~frey
Workshop Description
Overview
The Capital Asset Pricing Model (CAPM) makes some specific predictions about the market for securities. There are two that we will address here. First, that the relationship between the return of an asset i and the market M follows the relationship
ri(t)-rf = βrM(t)-rf +εi(t)
And second, the proportion of asset i in the market (i.e., tangent) portfolio is
βi
xi ∝ Var[εi]
Assignment
The assignment for this Workshop is to perform an analysis which computes the theoretical allocation, the actual allocation, and compares the two. You will be working with daily return data for the Dow Jones Industrial Index, which consists of 30 stocks, beginning 2013-01-02 and ending 2018-10-31, inclusive. The work involved is the following:
1. Load the necessary data. The required data files are all listed under Class 11 on the AMS 511 course page.
1.1. Import[ ] the daily return vector for the returns of the Dow Jones Industrial (DJI) Index which will represent the market. This is a vector of length 1471 with each element representing a different date.
https://www.coursehero.com/file/36587134/ams-511-11-wk-00pdf/
This study resource was shared via CourseHero.com
2
ams-511-11-wk-00.nb
1.2. Import[ ] the daily returns matrix for the thirty members of the DJI. This is a matrix of dimension 1471×30 with each row representing a different date and each column a different stock.
1.3. Import[ ] vectors representing the tickers of the DJI members (a vector of 30 strings).
1.4. Import[ ] the calendar of dates (a vector of length 1471 with each element a date represented by a vector of
length 3; alternately, it can be viewed as a 1471×3 matrix).
1.5. All of the above are aligned properly.
2. Perform a CAPM linear regression to estimate the betas and error variances of each member of the DJI. For simplicity assume an annual risk free rate of 2%. Approximate the daily rate as
(1 + 0.02)^(1 / 250) – 1.
3. Use these estimates of the betas and error variances to compute the proportional allocations of each as predicted by the CAPM and normalize them so they sum to one..
4. Use FinancialData[ticker, “MarketCap”] to download the market capitalization of the members of the DJI and use them to compute the actual proportion of each in the DJI. Again, normalize their sum to one.
5. Plot the CAPM allocations estimated in (3.) against the market’s observed in (4.).
6. Perform whatever additional comparisons you feel would be useful to characterize what you found.
7. What discrepancies do you note? How might you explain them?
Important
It’s important to remember that clarity and organization counts when submitting your work. As a professional if you can’t communicate what you’ve done effectively, then you often might as well not have done it. Please orga- nize and annotate the notebook you submit for this Workshop.
Hints and Aids
Using Import[ ]
It is suggested you copy the data files into the same directory as the notebook used for your Workshop. If you define a function
In[1]:= xLocal[s_]:=FileNameJoin[{NotebookDirectory[],s}] then you can use it with Import[ ] to load the necessary variables.
Return Data
The DJI tickers,
vsDJI = Import[xLocal[“vsDJI.m”]]; Length[vsDJI]
the daily returns of the DJI,
vnDJIReturns = Import[xLocal[“vnDJIReturns.m”]]; Dimensions[vnDJIReturns]
the daily returns of the thirty members of the DJI,
https://www.coursehero.com/file/36587134/ams-511-11-wk-00pdf/
This study resource was shared via CourseHero.com
Powered by TCPDF (www.tcpdf.org)
mnReturns = Import[xLocal[“mnReturns.m”]]; Dimensions[mnReturns]
and the calendar of dates.
vxReturnCalendar = Import[xLocal[“vxReturnCalendar.m”]]; Dimensions[vxReturnCalendar]
Market Capitalization
The market capitalization of a stock can be found by executing the code below, where sTicker is a string containing a valid ticker.
FinancialData[sTicker, “MarketCap”] Fitting the CAPM
To perform the regressions and capture the beta and error variance the following code (for LinearModelFit[ ]) can be used as a guide (although you should also read the documentation on the this function). The code below com- putes the β and Var[ε] for the ith stock in the DJI where nDailyRiskFree is the value of the appropriate risk free rate.
Flatten[LinearModelFit[
Transpose[{mnReturns〚All, i〛 – nDailyRiskFree, vnDJIReturns – nDailyRiskFree}],
.x, .x, IncludeConstantBasis → False][ ..
{“BestFitParameters”, “EstimatedVariance”}]]
Try executing the above for a particular stock (i.e., a particular value of i ∈ {1, …, 30}) to see what it does.
https://www.coursehero.com/file/36587134/ams-511-11-wk-00pdf/
ams-511-11-wk-00.nb 3
This study resource was shared via CourseHero.com