Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Dr.

Mark Hallam Autumn Term 22/23


University of Essex

BE-368: Finance Research Techniques Using Matlab


Lab Class 4

For the lab class this week, we will use the data contained in the Matlab file named
‘BE368 lab4 data.mat’ that you can download from the course’s Moodle page. This file
contains 17 years of monthly return data (from Jan 1999 to Dec 2015) for a ‘risk-free’
asset (‘rf’), the market portfolio (‘mkt’) and for 8 large US equities. The list of equities
are Apple (AAPL), Amazon (AMNZ), Citigroup (C), Chevron (CVX), General Electric
(GE), Intel (INTC), Procter & Gamble (PG) and Wallmart (WMT).
The data for each of these assets is contained in an individual numerical column
vector variable named as described above. We will perform most of our analysis and
calculations using these numerical vector variables, however there is also a timetable
copy of the complete dataset (‘alldata tt’) and a cell array containing variable names
(‘varnames’) that you may find useful.
Using these data for individual equities, we will repeat some of the same analysis we
did in the lecture using data for grouped portfolios that was related to the capital asset
pricing model (CAPM).

1. We will first perform some analysis and computations using the data for the energy
and oil company Chevron, contained in the vector variable ‘CVX’

(a) Using the vectors of return data for Chevron, the market portfolio and the
risk-free asset, create two new vector variables that contain the excess returns
of Chevron and the market portfolio above the risk-free rate (i.e. their returns
in excess of, or above, the risk-free rate).
(b) Produce a scatter plot with of the excess market returns (on the x-axis)
against the excess Chevron returns (on the y-axis). Add appropriate labels
to the two axes and the figure title.
(c) Based on your scatter plot from part (b), what sort of relationship appears
to exist between the excess market returns and excess Chevron returns?

2. Next we will estimate the CAPM market β for Chevron using linear regression.

(a) Use the fitlm function to create a new linear model object containing the
regression results from a linear regression that uses the excess Chevron returns
as the dependent variable and the excess market returns as the explanatory
variable.
(b) use the disp command with your linear model object’s name as an input to
display a text summary of the regression results.
(c) What is the estimated value of the CAPM β for Chevron?

1
(d) By indexing into this linear model object, create a new numerical variable
that contains Chevron’s estimated CAPM β.
(e) Also create new numerical vector/matrix variables containing the contents of
the following fields within the linear model object: the vector of fitted values
contained in the field ‘Fitted’, the raw/unadjusted residuals contained in the
field ‘Residuals.Raw’ and the value of the ordinary R-squared contained in
the field ‘Rsquared.Ordinary’.

3. We will now run the regression again using Matlab’s alternative regress function,
to check if we get the same estimate for the CAPM market β for Chevron.

(a) Create a new variable containing a vector of ones with the same size as the
vector of excess returns for the market portfolio. You can do this using the
ones(i,j) command, where i and j are the number of rows and columns.
(b) Use this vector of ones and the previous vectors of excess returns to estimate
the same form of linear regression model as in question 2 using the regress
command (i.e. excess Chevron returns as the dependent variable, a constant
and the excess market returns as explanatory variables).
(c) Compare the estimate of β you obtain with the previous estimate obtained
from the fitlm function.

4. Finally, we will investigate how the CAPM market β varies between assets, and
over time.

(a) Choose any one of the other equities in the dataset and produce a new set of
regression results using the fitlm function.
(b) How does the estimated value of the CAPM β for your second equity compare
to that for Chevron? What does this imply about the relative volatility of
the two equities?
(c) Again using the fitlm function, re-estimate the CAPM market β for Chevron,
but this time use only the return data for 04-Jan-1999 to 31-Dec-2007. Then
repeat this again using the only the data for 01-Jan-2008 to 01-Dec-2015. You
may find the timetable copy of the dataset useful for this task.
(d) Do you observe time variation in the value of the CAPM market β for Chevron
across these time periods?

You might also like