You are on page 1of 1

London School of Economics

FM 320 Quantitative Finance Classwork Week 4

4 Univariate Volatility Modeling

You can download data directly from web pages, such as The easiest way is
to use a function named hist stock data. You can find the function on moodle.
1 p r i c e=h i s t s t o c k d a t a ( 01012004 , 31122014 , yhoo ) ; % c a l l s Yahoo s t o c k
from 01/01/2004 t o 31/12/2014
2 p r i c e r e s o r t=p r i c e . AdjClose ( end : 1 : 1 ) ; %s o r t e d from o l d e s t t o n e w e s t
3 y=d i f f ( log ( p r i c e r e s o r t ) ) ; % c a l c u l a t i n g r e t u r n s

1. Using the hist stock data() function, download the prices for the stocks: yhoo,bhp,aapl,ms,dis,ko.
Calculate the returns.
2. Calculate a moving average volatility model (using 20 and 60 day window), plot and analyze
the results. A moving average volatility t is created as follows. Suppose WE is the window
length and T the data length, then

1 X
t2 = y2
WE i=1 ti

3. Create a Matlab function called mwplot.m which takes two arguments mwplot(r,WE). It
will calculate the forecast volatility using a WE day window, and make the plots showing
the returns and plus/minus 2 standard deviations. Use mwplot(r,WE) to make volatility
plots for the two stocks changing WE. Instead of using zeros() to initialize sigma use
In Matlab a variable can hold a number, text, or be defined as Not a Number or NaN. The
advantage of using this is that a variable that is NaN will not be considered in calculations
and will not be plotted.
4. Consider the problem of identifying the statistical properties of financial returns.
(a) Identify, and briefly describe, the main statistical properties of returns.
(b) Propose one statistical test for non-normality, and briefly describe the test, both
verbally and mathematically.
(c) Propose a statistical test for autocorrelation, and briefly describe the test, both ver-
bally and mathematically.
(d) what is a qqplot?
(e) Consider the problem of analyzing autocorrelation in squared returns of some stock.
The ACF plot you find has a typical shape. Suppose the stock falls in price 60%
because of an unexpected adverse earnings announcement. How might that affect the
ACF plot and your analysis of volatility dynamics?
(f) If we calculate the annual return of a stock index like the SP-500 over a century, we
might find that the annual returns are very low when adjusted for inflation. Why is
this result misleading?

FM 320 4-1