November 7th, 2013, 4:42 pm
I have written matlab code for 100 days forecast of variance by using high frequency data. Following is the code . Is it a write procedure that I am following Or something wrong with it? Could someone consider this post please.data can also be provided upon asking. Thanksy1=epsilon; %%% Returns for Estimationy_ev=epsilon_ev;%%% Return for Evaulation of Forecast[cof,error, llf,ino,sig] = garchfit(cof,y1); cof(1)= K=0.00095; cof(3)=beta=0.9079; cof(2)= alpha=0.0774; T=156672; %%% Total observations R=127872;%%% In Sample observationsn=T-R; %%% Out of Sample observationforecast_Garch=zeros(n,1);forecast_Garch(1)=K+alpha*(y1(end)^2)+beta*sig(end)^2;for i=2:n-1;forecast_Garch(i)=K+alpha*(y_ev(i-1)^2)+beta*forecast_Garch(i-1);endH=forecast_Garch;H=vec2mat(H,288); %converting 5m high frequency variance forecast to daily forecast Hhat=H'; H_daily=sum(Hhat); ret_ev=vec2mat(y_ev,288); %converting out of sample data to daily data ret_ev=ret_ev';vol_true=sum(ret_ev.^2); % Realized variance plot(H_daily,'r');hold on;plot(vol_true,'b');