Empirical Finance Spring II 2022 Problem Set 2 Solutions
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
Empirical Finance Spring II 2022
Problem Set 2 Solutions
Q1. The attached file, Dis vol data .xlsx, contains daily adjusted closing prices for The Walt Disney Company between April 24th of 2017 and April 22nd of 2022 as well as realized variance (calculated using one-minute return data) from December 27th of 2021 to April 22nd, 2022. Modify the OPTIMIZATION .m code from Week4 to use this Disney data and do the following:
1. [4 pts] Estimate a GARCH(1,1) model for the variance of Disney daily log returns (the current code does it for simulated return data from the SIMULATE .m code).
See code below.
2. [4 pts] Report the estimates of your parameters from the GARCH(1,1) model: ω , α 1 and β1 .
ω α 1 β1 |
9.8223e-06 0.069743 0.90013 |
3. [4 pts] Calculate and report the sample variance of Disney log returns as well as the unconditional mean of the variance, E[σt(2)], that is implied by your parameters (make sure to show how you are calculating this from the parameters). Comment on how well they compare to each other.
The sample variance is var(data daily .ret) = 0.03537%. We calculate the unconditional variance as:
E σt(2) = = 0.03260%
The unconditional and sample variance seem to match up very well. Even if we multiply their difference by 252 (trading days), the annualize difference is just 0.007%.
4. [4 pts] Plot the estimated daily variance from your model over the entire dataset as well as the realized variance. Note: You can simply use the realized variance column as your var vec, which was the original simulated variance in the lecture code. Comment on how well the estimated variance from your model compares to the realized variance in the Dec 2021 to April 2022 portion.
Here are the full plot and a plot zoomed in to the overlap period. The overlap period looks awful. Doesn’t really match up at all.
10-3
5
true variance
estimated variance
4
3
2
1
0
2017 2018 2019 2020 2021 2022
10-3
true variance
estimated variance
Nov 2021 Jan 2022 Mar 2022 May 2022
5. [4 pts] Next, restrict your data to only the dates where the Disney adjusted close data and the realized variance data overlap, then re-estimate your GARCH(1,1) model on this smaller dataset. Report your new ω , α 1 and β1
ωoverlap α 1,overlap β1,overlap |
0.00022007 0.58145 2.1715e-07 |
6. [2 pts] Comment on these new estimated parameters (compared to those from the full dataset) as well as whether the plot of estimated variance compared to realized
variance looks any better after estimating on this shorter dataset. The parameters are much different, as ω and α 1 are a lot bigger, and β1 is basically zero. This means that the previous squared return dominates the persistence rather than the previous variance, whereas the opposite was the case in the full data set. This does, however, lead to a much better overlap in the plot.
5
4
3
2
1
0
Dec
10-3
true variance
estimated variance
2021 Jan 2022 Feb 2022 Mar 2022 Apr 2022 May 2
7. [3 pts] Do you think the shorter estimate is the better option based on the results you obtained? Why or why not? Hint: Look at the parameters you estimated using the shorter dataset, not just the plot. Also note that there is no right answer here, but it’s about showing your reasoning.
It’s difficult to say which is better. It seems pretty unreasonable, given our model assumptions, that the prior variance would have no weight (as in the shortened model with a near-zero β1 ), but obviously the first model did a terrible job of following during the overlap period. It seems like there are several things we might try to improve things:
❼ Use more lags in the model
❼ Assume time-varying parameters and maybe estimate the model over
a rolling window
❼ Other suggestions?...
Also, one thing that I was going to ask your groups to do if I had released the assignment earlier was to look at what happened on a couple specific days using the one-minute-return data that I used to calculate realized variance. There were a couple days in the data where Disney stock moved a great
deal overnight. This overnight movement is reflected in the daily realized volatility, but not in the return data. For instance, look at the daily data for February 9th and 10th, noting that February 10th was the day that saw the greatest realized variance:
Notice that the closing price February 9th was ✩147.23 and the opening price on Feb 10th was ✩156.02. Since the realized variance formula I used includes the squared overnight return, and the daily return (calculated using the two daily closing prices) was much smaller than even this one return, there is little chance to make the daily model catch this realized
variance:
M
RVt =X rm(2),t + r t − 1)→t,overnight
m=1
Where rm,t are the one-minute returns on day t and r(t− 1)→t,overnight is the overnight return from the end of day (t − 1) to the start of day t.
Matlab Code
1 clc ; clear ; close a l l ;
2 % Utilizes the simul . mat f i l e output from the SIMULATE .m script f i l e .
3 % contains variables rvec , svec and truepara
4 ticker = ”DIS”;
5 data daily = readtable ( ticker + ” vol data . xlsx ”) ;
6 data daily . l a d j c l o s e = log ( data daily . AdjClose ) ; 7 %return ;
8 data daily . ret = [NaN; d i f f ( data daily . l a d j c l o s e ) ] ;
9 data daily = data daily (2: end , : ) ;
10 % Note : Uncomment the line below to limit to the overlap time period 11 data daily = data daily ( data daily . Date>=datetime (2021 ,12 ,27) ,:) ;
12 plot ( data daily . Date , data daily . ret ) ;
13 var vec = data daily . realized var ;
14 t i t l e ( ticker + ” daily returns ”) ;
15
16 % set boundary
17 bound = [ [ 0 1 ] ; % omega bounds
18 [0 1 ] ; % alpha bounds
19 [0 1 ] ] ; % beta bounds
20
21 % function to minimize
22 rvec = data daily . ret ;
23 myfun = @(x) ❂ loglikelihood garch11 ( data daily . ret , x) ;
24
25 % options for local solver ( use fmincon )
26 options = optimoptions ( ’fmincon ’, ’Algorithm ’, ’interior ❂point ’, . . . 27 ’TolFun ’, 1e ❂ 18, ’TolX ’, 1e ❂ 18, ’Display ’, ’i t e r ’, . . .
28 ’GradObj ’, ’o ff ’, ’Diagnostics ’, ’on ’, . . .
29 ’MaxFunEvals ’, 1e7 , ’MaxIter ’, 500) ;
30
31 % i n i t i a l values
32 init para = [0 . 15 0 . 79 0 . 1 5 ] ;
33
34 % run fmincon
35 [ para , fval , exitflag , output , lambda , grad , hessian ] = . . .
36 fmincon (myfun , init para , [ ] , [ ] , [ ] , [ ] , bound (: ,1) ,bound (: ,2) , [ ] , options ) ;
37
38 param table = array2table ( para ’, . . .
39 ”RowNames”,[”omega” ”alpha” ”beta ”] , . . .
40 ”VariableNames ”,”Estimated ”) ;
41 disp ( param table ) ;
42
43 % run MLE and compute the f i l t e r e d variance
44 [ lh0 , var vec0 ] = loglikelihood garch11 ( data daily . ret , para ) ;
45
46 scrsz = get (0 , ’ScreenSize ’) ;
47 set (0 , ’defaulttextinterpreter ’, ’latex ’)
48 set (0 , ’defaultaxesfontname ’, ’times ’)
49 set (0 , ’DefaultAxesFontSize ’,30)
50 set (0 , ’DefaultTextFontSize ’,30) ;
51
52 f i g =figure ( ’Position ’,[20 ,20 ,900 ,600] , ’Name ’, ’’, ’Color ’, ’w’ , . . . 53 ’Position ’,[1 scrsz (4) /20 scrsz (3) /2 scrsz (4) /1 . 5]) ;
54 hold on
55 k1=plot ( data daily . Date , var vec , ’linewidth ’,3) ;
56 k2=plot ( data daily . Date , var vec0 , ’r ❂❂’, ’linewidth ’,3) ;
57 %k3=plot ( data daily . Date , data daily . ret . ˆ2 , ’g ❂❂ ’,’linewidth ’,3) ;
58 kk=legend ( [ k1 , k2 ] , ’true variance ’, ’estimated variance ’) ;
59 set (kk , ’location ’, ’northeast ’)
60 legend ( ’boxoff ’) ;
61 t i t l e ( ticker + ” daily variance ”) ;
62
63 omega = para (1) ; alpha = para (2) ; beta = para (3) ;
64 mean unconditional = omega/(1 ❂ (alpha+beta ) ) ;
65 sample var = var ( data daily . ret ) ;
66
67 f p r i n t f (”Unconditional variance (params) : %.5 f%%,\nSample variance : % .5 f%%\n ”, . . .
68 100✯ mean unconditional ,100 ✯ sample var ) ;
2022-05-17