├── .DS_Store ├── MIDAS └── realized_garch_midas.m ├── README.md ├── Realized EGARCH ├── MIDAS │ ├── EPU │ │ ├── realized_egarch_midas_epu.m │ │ ├── realized_egarch_midas_epu_rv.m │ │ ├── test_reegarach_midas_epu.m │ │ ├── test_reegarch_midas_epu_rv.m │ │ └── test_reegarch_midas_vol2.m │ ├── realized_egarch_midas.m │ ├── realized_egarch_midas_vol2.m │ └── test_reegarch_midas.m ├── montecarlo_egarch.m ├── news_impact_reegarch.m ├── realized_egarch.m ├── realized_egarch_DGP.m └── test_reegarch.m ├── montecarlo.m ├── realized_garch.m ├── realized_garch_DGP.m ├── simulate_realized_garch.m ├── test_realized_garch_family.m └── test_regarch.m /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hide-kg/Realized-GARCH/a25796b82f0515f5886582e7d9c5060db8aacb3e/.DS_Store -------------------------------------------------------------------------------- /MIDAS/realized_garch_midas.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hide-kg/Realized-GARCH/a25796b82f0515f5886582e7d9c5060db8aacb3e/MIDAS/realized_garch_midas.m -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Realized-GARCH 2 | P. R. Hansen, Z. Huang and H. H. Shek. (2012). Realized GARCH: A Joint Model for Returns and Realized Measures of Volatility, Journal of Applied Econometrics. 3 | 4 | ## Realized EGARCH 5 | P. R. Hansen and Z.Huang. (2016). Exponential GARCH Modeling with Realized Measures of Volatility, Journal of Business and Economic Statistics. 6 | -------------------------------------------------------------------------------- /Realized EGARCH/MIDAS/EPU/realized_egarch_midas_epu.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hide-kg/Realized-GARCH/a25796b82f0515f5886582e7d9c5060db8aacb3e/Realized EGARCH/MIDAS/EPU/realized_egarch_midas_epu.m -------------------------------------------------------------------------------- /Realized EGARCH/MIDAS/EPU/realized_egarch_midas_epu_rv.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hide-kg/Realized-GARCH/a25796b82f0515f5886582e7d9c5060db8aacb3e/Realized EGARCH/MIDAS/EPU/realized_egarch_midas_epu_rv.m -------------------------------------------------------------------------------- /Realized EGARCH/MIDAS/EPU/test_reegarach_midas_epu.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hide-kg/Realized-GARCH/a25796b82f0515f5886582e7d9c5060db8aacb3e/Realized EGARCH/MIDAS/EPU/test_reegarach_midas_epu.m -------------------------------------------------------------------------------- /Realized EGARCH/MIDAS/EPU/test_reegarch_midas_epu_rv.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hide-kg/Realized-GARCH/a25796b82f0515f5886582e7d9c5060db8aacb3e/Realized EGARCH/MIDAS/EPU/test_reegarch_midas_epu_rv.m -------------------------------------------------------------------------------- /Realized EGARCH/MIDAS/EPU/test_reegarch_midas_vol2.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hide-kg/Realized-GARCH/a25796b82f0515f5886582e7d9c5060db8aacb3e/Realized EGARCH/MIDAS/EPU/test_reegarch_midas_vol2.m -------------------------------------------------------------------------------- /Realized EGARCH/MIDAS/realized_egarch_midas.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hide-kg/Realized-GARCH/a25796b82f0515f5886582e7d9c5060db8aacb3e/Realized EGARCH/MIDAS/realized_egarch_midas.m -------------------------------------------------------------------------------- /Realized EGARCH/MIDAS/realized_egarch_midas_vol2.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hide-kg/Realized-GARCH/a25796b82f0515f5886582e7d9c5060db8aacb3e/Realized EGARCH/MIDAS/realized_egarch_midas_vol2.m -------------------------------------------------------------------------------- /Realized EGARCH/MIDAS/test_reegarch_midas.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hide-kg/Realized-GARCH/a25796b82f0515f5886582e7d9c5060db8aacb3e/Realized EGARCH/MIDAS/test_reegarch_midas.m -------------------------------------------------------------------------------- /Realized EGARCH/montecarlo_egarch.m: -------------------------------------------------------------------------------- 1 | clear 2 | clc 3 | para = [0.05, 0.1, 0.9, -0.1, 0.1, 0.1, 0.2, 0.9, -0.1, 0.1, sqrt(0.8)]; 4 | T = 500; 5 | 6 | DGP = realized_egarch_DGP(para, T); 7 | 8 | daily_return = DGP.return; 9 | RV = DGP.realized; 10 | test_start = T-1; 11 | 12 | N = 1000; 13 | for ite = 1:N 14 | DGP = realized_egarch_DGP(para, T); 15 | daily_return = DGP.return(2:T); 16 | RV = DGP.realized(2:T); 17 | [estimpara] = realized_egarch(daily_return, RV, test_start); 18 | r1(ite) = estimpara.return; 19 | garch1(ite,:) = estimpara.garch; 20 | measu1(ite,:) = estimpara.measurement; 21 | end 22 | para 23 | estim_para = [mean(r1), mean(garch1), mean(measu1)] 24 | -------------------------------------------------------------------------------- /Realized EGARCH/news_impact_reegarch.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hide-kg/Realized-GARCH/a25796b82f0515f5886582e7d9c5060db8aacb3e/Realized EGARCH/news_impact_reegarch.m -------------------------------------------------------------------------------- /Realized EGARCH/realized_egarch.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hide-kg/Realized-GARCH/a25796b82f0515f5886582e7d9c5060db8aacb3e/Realized EGARCH/realized_egarch.m -------------------------------------------------------------------------------- /Realized EGARCH/realized_egarch_DGP.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hide-kg/Realized-GARCH/a25796b82f0515f5886582e7d9c5060db8aacb3e/Realized EGARCH/realized_egarch_DGP.m -------------------------------------------------------------------------------- /Realized EGARCH/test_reegarch.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hide-kg/Realized-GARCH/a25796b82f0515f5886582e7d9c5060db8aacb3e/Realized EGARCH/test_reegarch.m -------------------------------------------------------------------------------- /montecarlo.m: -------------------------------------------------------------------------------- 1 | clear 2 | clc 3 | N = 100; 4 | para = [0.2, 0.6, 0.3, 0.1, 1, sqrt(0.8), -0.05, 0.2]; 5 | T = 500; 6 | test_start = 499; 7 | 8 | for ite = 1:N 9 | type = 1; 10 | DGP1 = realized_garch_DGP(para, type, T); 11 | daily_return1 = DGP1.return(2:T); 12 | RV1 = DGP1.realized(2:T); 13 | [estimpara1] = realized_garch(daily_return1, RV1, type, test_start); 14 | garch1(ite,:) = estimpara1.garch; 15 | measu1(ite,:) = estimpara1.measurement; 16 | end 17 | 18 | 19 | 20 | mean(garch1) 21 | mean(measu1) 22 | -------------------------------------------------------------------------------- /realized_garch.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hide-kg/Realized-GARCH/a25796b82f0515f5886582e7d9c5060db8aacb3e/realized_garch.m -------------------------------------------------------------------------------- /realized_garch_DGP.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hide-kg/Realized-GARCH/a25796b82f0515f5886582e7d9c5060db8aacb3e/realized_garch_DGP.m -------------------------------------------------------------------------------- /simulate_realized_garch.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hide-kg/Realized-GARCH/a25796b82f0515f5886582e7d9c5060db8aacb3e/simulate_realized_garch.m -------------------------------------------------------------------------------- /test_realized_garch_family.m: -------------------------------------------------------------------------------- 1 | clc 2 | 3 | clear 4 | 5 | sector = 01; 6 | 7 | filename = sprintf('TOPIX17_RV_%02d.mat', sector); 8 | load('EPU.mat') 9 | load('sample_in_month.mat') 10 | 11 | load(filename); 12 | 13 | daily_return = daily_return_o2c; 14 | 15 | test_start = 1000; 16 | start_time = 1000; 17 | %% GARCH 18 | [estimpara_garch, forecast_fit_garch, logL_garch] = garch(daily_return, test_start); 19 | qlike_garch = mean(loss_function(RV, forecast_fit_garch.cond_vol, 0)); 20 | stein_garch = mean(loss_function(RV, forecast_fit_garch.cond_vol, 1)); 21 | mse_garch = mean(loss_function(RV, forecast_fit_garch.cond_vol, 3)); 22 | 23 | %% EGARCH 24 | [estimpara_egarch, forecast_fit_egarch, logL_egarch] = egarch(daily_return, test_start); 25 | qlike_egarch = mean(loss_function(RV(start_time:end), forecast_fit_egarch.cond_vol(start_time:end), 0)); 26 | stein_egarch = mean(loss_function(RV(start_time:end), forecast_fit_egarch.cond_vol(start_time:end), 1)); 27 | mse_egarch = mean(loss_function(RV(start_time:end), forecast_fit_egarch.cond_vol(start_time:end), 3)); 28 | 29 | %% Realized GARCH 30 | type = 0; 31 | [estimpara, forecast_fit, logL, std_err, tstat] = realized_garch(daily_return, RV, type, test_start); 32 | qlike_rgarch = mean(loss_function(RV(start_time:end), forecast_fit.cond_vol(start_time:end), 0)); 33 | stein_rgarch = mean(loss_function(RV(start_time:end), forecast_fit.cond_vol(start_time:end), 1)); 34 | mse_rgarch = mean(loss_function(RV(start_time:end), forecast_fit.cond_vol(start_time:end), 3)); 35 | 36 | %% Realized GARCH (log) 37 | type = 1; 38 | [estimpara_log, forecast_fit_log, logL_log, std_err_log, tstat_log] = realized_garch(daily_return, RV, type, test_start); 39 | qlike_rgarch_log = mean(loss_function(RV(start_time:end), forecast_fit_log.cond_vol(start_time:end), 0)); 40 | stein_rgarch_log = mean(loss_function(RV(start_time:end), forecast_fit_log.cond_vol(start_time:end), 1)); 41 | mse_rgarch_log = mean(loss_function(RV(start_time:end), forecast_fit_log.cond_vol(start_time:end), 3)); 42 | 43 | %% Realized EGARCH 44 | [estimpara_reegarch, forecast_fit_reegarch, logL_reegarch, stderror_reegarch, tstat_reegarch] = realized_egarch(daily_return, RV, test_start); 45 | qlike_reegarch = mean(loss_function(RV(start_time:end), forecast_fit_reegarch.cond_vol(start_time:end), 0)); 46 | stein_reegarch = mean(loss_function(RV(start_time:end), forecast_fit_reegarch.cond_vol(start_time:end), 1)); 47 | mse_reegarch = mean(loss_function(RV(start_time:end), forecast_fit_reegarch.cond_vol(start_time:end), 3)); 48 | 49 | %% Realized EGARCH MIDAS 50 | K = 240; 51 | [estimpara_midas, forecast_fit_midas, logL_midas, stderror_midas, tstat_midas] = realized_egarch_midas(daily_return, RV, test_start, K); 52 | 53 | qlike_reegarch_midas = mean(loss_function(RV(start_time:end), forecast_fit_midas.cond_vol(start_time:end), 0)); 54 | stein_reegarch_midas = mean(loss_function(RV(start_time:end), forecast_fit_midas.cond_vol(start_time:end), 1)); 55 | mse_reegarch_midas = mean(loss_function(RV(start_time:end), forecast_fit_midas.cond_vol(start_time:end), 3)); 56 | 57 | %% Realized EGARCH MIDAS EPU 58 | L = 6; 59 | test_start = cumsum(sample_in_month); 60 | [estimpara_epu, forecast_fit_epu] = realized_egarch_midas_epu(daily_return, RV, epu, sample_in_month, test_start(49), L); 61 | qlike_epu = mean(loss_function(RV(start_time:end), forecast_fit_epu.cond_vol(start_time:end),0)); 62 | stein_epu = mean(loss_function(RV(start_time:end), forecast_fit_epu.cond_vol(start_time:end),1)); 63 | mse_epu = mean(loss_function(RV(start_time:end), forecast_fit_epu.cond_vol(start_time:end),3)); 64 | 65 | %% Realized EGARCH MIDAS EPU and RV 66 | [estimpara_epu_rv, forecast_fit_epu_rv] = realized_egarch_midas_epu_rv(daily_return, RV, epu, sample_in_month, test_start(49), L); 67 | qlike_epu_rv = mean(loss_function(RV(start_time:end), forecast_fit_epu_rv.cond_vol(start_time:end),0)); 68 | stein_epu_rv = mean(loss_function(RV(start_time:end), forecast_fit_epu_rv.cond_vol(start_time:end),1)); 69 | mse_epu_rv = mean(loss_function(RV(start_time:end), forecast_fit_epu_rv.cond_vol(start_time:end),3)); 70 | -------------------------------------------------------------------------------- /test_regarch.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hide-kg/Realized-GARCH/a25796b82f0515f5886582e7d9c5060db8aacb3e/test_regarch.m --------------------------------------------------------------------------------