Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit


Computational Finance  HW 2

Complete the following problems in your home work groups. All calculations must be done in MATLAB.     When the question tells you to report or output an answer, your code must print it using the disp or       printf functions. When the question tells you to plot something, your code must produce a MATLAB     figure. When the question asks you to describe something or compare, you need to answer it in your own words. Type your answer as a comment in your code file. See the Sample Homework on OneDrive as a      template. I recommend starting each script file with commands to close all figures, clear the workspace,   and clear the command window: close all; clc; clear;

1.    In this question, you will construct an investment strategy and assess its historical performance. The      construction of a quantitative investment strategy is a multi-step process. First, you must sort stocks      based on some characteristic you observe during the estimation period. Based on this sort, you then     decide which stocks you will go long (take a positive position in) and which stocks you will short (take a negative position in). To assess the performance of the strategy, you calculate the returns on this            portfolio during the test period and summarize its performance using standard measures of risk. It is     crucial that the test period come after the estimation period i.e., that the portfolio is constructed based on information known at the time of construction.1

In the HW 2 OneDrive folder, you will find 3 data files:

- returns.xlsx has monthly stock returns for many companies

- marketcaps.xlsx has total market capitalizations (stock price x shares outstanding) for these companies. You can assume that columns are

- F-F_Research_Factors.TXT has Fama-French factor data

You will also find a code file: estimate_capm(). This is a function that I wrote to help you estimate CAPM betas and alphas. Put in the folder where you write your code and use it like you would any      MATLAB function. Refer to its documentation for help.

a.    Set the estimation period to Jan 2001 – Dec 2010 and estimate the CAPM betas of each stock.

b.    Identify which stocks are in the lowest decile and which stocks are in the highest decile by beta. That is, find stocks whose betas are lower than the 10th  percentile beta, or higher than the 90th percentile beta.2  Plot a histogram3  of all betas and add lines to the plot to indicate these percentiles.

We will now construct a portfolio, where we will go long (take positive positions in) the lowest-beta stocks and we will go short (take negative positions in) the highest-beta stocks.

The idea behind long-short portfolios is as follows. The portfolio manager goes long stocks that she    believes will perform well and short similar stocks that she believes will perform less well (not             necessarily poorly). The less-well performing stocks act as a hedge. For example, if the overall market goes down, the long leg of the portfolio will go down, but the short leg will go up. As a result, she       expects to generate a high return with limited market exposure.

This is an investment strategy called “betting against beta” and was introduced by AQR, a large quantitative asset manager.

c.    Calculate the returns on an equal-weighted portfolio that goes long lowest-decile betas and short highest decile betas over the test period of Jan 2011 – Dec 2020.

Hint: if there are 2 long stocks A and B and 2 short stocks C and D, the return on your portfolio at  time t should be !,#$  = !,#  − !,$ , where !,#  = 0.5 !,%  + 0.5 !,&  is the equal-weighted return on the “ long leg” and !,$  = 0.5 !,'  + 0.5 !,(  is the equal-weighted return on the “short leg.” If each leg had 3 stocks instead, the weights would be 1/3 = 0.333 … instead of 0.5, and so on.

d.    Report the monthly mean and volatility of this portfolio in percent.

When constructing long-short portfolios, we should make sure that these returns are not just                  compensation for beta. Recall CAPM – you can always generate a high expected return by investing in a high-beta stock. But then you’re just taking on extra market risk. So, let’s check to see if the betting-      against-beta portfolio you constructed is a high-beta portfolio or if it indeed has high alpha – positive    performance unrelated to its market exposure.

e.    Estimate the CAPM beta and alpha. Report beta as is and alpha in percent. Has this portfolio delivered good performance? How about risk-adjusted good performance? Why or why not?

f.     Repeat steps (c) and (d) but this time constructing value-weighted portfolio legs instead of an equal-weighted ones. How do your results change? Are your main conclusions altered?

In a value-weighted leg, the weights on each stock depend on the size of company, where size is     measured using the previous period’s market capitalization. If ! ) *,+  is the market-cap of stock i at time t-1!,+  is the return of stock i at time t,  #  is the number of stocks in the long leg and $  is     the number of stocks in the short leg

!,#  = ∑*  !,+  and !,$  = ∑ !,+ .