> library("fSeries") > source("garchOxFit_R.txt") > > #Q1 > data.Q1 = read.table("d-sbuxsp0106.txt", header=F) > sbux = log(data.Q1[,2]+1)*100 > > #Q1.a > Box.test(sbux,10) Box-Pierce test data: sbux X-squared = 19.7627, df = 10, p-value = 0.03158 > > #Q1.b > Box.test(arima(sbux,order=c(1,0,0))$resid^2,10) Box-Pierce test data: arima(sbux, order = c(1, 0, 0))$resid^2 X-squared = 51.7356, df = 10, p-value = 1.277e-07 > 1-pchisq(Box.test(arima(sbux,order=c(1,0,0))$resid^2,10)$stat,10-1) X-squared 5.07155e-08 > > #Q1.c > fit1c=garchOxFit(~arma(1,0),~garch(1,1),sbux) Maximum Likelihood Estimation (Std.Errors based on Second derivatives) Coefficient Std.Error t-value t-prob Cst(M) 0.123360 0.044494 2.773 0.0056 AR(1) -0.074761 0.026711 -2.799 0.0052 Cst(V) 0.014720 0.0072104 2.041 0.0414 ARCH(Alpha1) 0.018496 0.0044392 4.166 0.0000 GARCH(Beta1) 0.977553 0.0051893 188.4 0.0000 *************** ** FORECASTS ** *************** Number of Forecasts: 15 Horizon Mean Variance 1 0.1956 2.801 2 0.118 2.804 3 0.1238 2.807 4 0.1233 2.81 5 0.1234 2.813 *********** ** TESTS ** *********** Statistic t-Test P-Value Skewness 0.35674 5.6592 1.5204e-008 Excess Kurtosis 3.9274 31.173 2.4880e-213 Jarque-Bera 1000.5 .NaN 5.5490e-218 --------------- Q-Statistics on Standardized Residuals --> P-values adjusted by 1 degree(s) of freedom Q( 10) = 4.51861 [0.8740948] Q( 15) = 9.36721 [0.8068322] Q( 20) = 12.4033 [0.8676690] H0 : No serial correlation ==> Accept H0 when prob. is High [Q < Chisq(lag)] -------------- Q-Statistics on Squared Standardized Residuals --> P-values adjusted by 2 degree(s) of freedom Q( 10) = 3.65558 [0.8867852] Q( 15) = 7.09523 [0.8971777] Q( 20) = 9.87613 [0.9358745] H0 : No serial correlation ==> Accept H0 when prob. is High [Q < Chisq(lag)] > > #Q1.d > fit1d=garchOxFit(~arma(1,0),~garch(1,1),sbux, cond.dist = "t") Maximum Likelihood Estimation (Std.Errors based on Second derivatives) Coefficient Std.Error t-value t-prob Cst(M) 0.062418 0.039698 1.572 0.1161 AR(1) -0.064876 0.024234 -2.677 0.0075 Cst(V) 0.025449 0.017418 1.461 0.1442 ARCH(Alpha1) 0.027412 0.010400 2.636 0.0085 GARCH(Beta1) 0.966020 0.013150 73.46 0.0000 Student(DF) 4.744308 0.54129 8.765 0.0000 *************** ** FORECASTS ** *************** Number of Forecasts: 15 Horizon Mean Variance 1 0.1212 2.504 2 0.05861 2.513 3 0.06267 2.522 4 0.0624 2.531 5 0.06242 2.539 *********** ** TESTS ** *********** Statistic t-Test P-Value Skewness 0.40240 6.3836 1.7295e-010 Excess Kurtosis 4.2706 33.897 7.4897e-252 Jarque-Bera 1185.9 .NaN 3.1312e-258 --------------- Q-Statistics on Standardized Residuals --> P-values adjusted by 1 degree(s) of freedom Q( 10) = 4.00831 [0.9108649] Q( 15) = 8.61517 [0.8548849] Q( 20) = 11.7186 [0.8972968] H0 : No serial correlation ==> Accept H0 when prob. is High [Q < Chisq(lag)] -------------- Q-Statistics on Squared Standardized Residuals --> P-values adjusted by 2 degree(s) of freedom Q( 10) = 3.08069 [0.9291924] Q( 15) = 5.18609 [0.9708647] Q( 20) = 8.11976 [0.9768000] H0 : No serial correlation ==> Accept H0 when prob. is High [Q < Chisq(lag)] > > #Q2 > sp = log(data.Q1[,3]+1)*100 > > #Q2.a > Box.test(sp,10) Box-Pierce test data: sp X-squared = 12.1864, df = 10, p-value = 0.2728 > > #Q2.b > Box.test(sp^2,10) Box-Pierce test data: sp^2 X-squared = 844.3426, df = 10, p-value < 2.2e-16 > > #Q2.cd > fit2c=garchOxFit(~arma(0,0),~igarch(1,1),sp, cond.dist = "t") Maximum Likelihood Estimation (Std.Errors based on Second derivatives) Coefficient Std.Error t-value t-prob Cst(M) 0.039003 0.020042 1.946 0.0518 Cst(V) 0.002823 0.0019377 1.457 0.1453 ARCH(Alpha1) 0.062853 0.013352 4.707 0.0000 Student(DF) 14.156357 4.8659 2.909 0.0037 GARCH(Beta1) 0.937147 No. Observations : 1507 No. Parameters : 5 Mean (Y) : 0.00475 Variance (Y) : 1.16169 Skewness (Y) : 0.15284 Kurtosis (Y) : 5.82726 Log Likelihood : -2002.064 *************** ** FORECASTS ** *************** Number of Forecasts: 15 Horizon Mean Variance 1 0.039 0.2492 2 0.039 0.252 3 0.039 0.2548 4 0.039 0.2576 5 0.039 0.2605 *********** ** TESTS ** *********** Statistic t-Test P-Value Skewness -0.082601 1.3104 0.19006 Excess Kurtosis 0.48514 3.8507 0.00011779 Jarque-Bera 16.492 .NaN 0.00026225 --------------- Q-Statistics on Standardized Residuals Q( 10) = 9.79245 [0.4588876] Q( 15) = 14.0084 [0.5248945] Q( 20) = 19.9950 [0.4582414] H0 : No serial correlation ==> Accept H0 when prob. is High [Q < Chisq(lag)] -------------- Q-Statistics on Squared Standardized Residuals --> P-values adjusted by 2 degree(s) of freedom Q( 10) = 6.37590 [0.6052037] Q( 15) = 12.1980 [0.5114764] Q( 20) = 14.7345 [0.6801118] H0 : No serial correlation ==> Accept H0 when prob. is High [Q < Chisq(lag)] > > #Q3 > #Q3.ab > fit3a=garchOxFit(~arma(1,0),~garch(1,1),sbux, cond.dist = "t", arch.in.mean=T) Maximum Likelihood Estimation (Std.Errors based on Second derivatives) Coefficient Std.Error t-value t-prob Cst(M) 0.126181 0.092566 1.363 0.1730 AR(1) -0.065330 0.024268 -2.692 0.0072 Cst(V) 0.026032 0.018081 1.440 0.1502 ARCH(Alpha1) 0.027568 0.010788 2.555 0.0107 GARCH(Beta1) 0.965709 0.013729 70.34 0.0000 Student(DF) 4.751910 0.54316 8.749 0.0000 ARCH-in-mean(var) -0.018643 0.024492 -0.7612 0.4467 No. Observations : 1507 No. Parameters : 7 Mean (Y) : 0.07722 Variance (Y) : 4.30800 Skewness (Y) : 0.32455 Kurtosis (Y) : 7.33979 Log Likelihood : -3064.284 Alpha[1]+Beta[1]: 0.99328 *************** ** FORECASTS ** *************** Number of Forecasts: 15 Horizon Mean Variance 1 0.1393 2.501 2 0.07496 2.51 3 0.07897 2.519 4 0.07853 2.528 5 0.07838 2.537 *********** ** TESTS ** *********** Statistic t-Test P-Value Skewness 0.40428 6.4136 1.4215e-010 Excess Kurtosis 4.2857 34.016 1.2805e-253 Jarque-Bera 1194.3 .NaN 4.4970e-260 --------------- Q-Statistics on Standardized Residuals --> P-values adjusted by 1 degree(s) of freedom Q( 10) = 4.04716 [0.9082810] Q( 15) = 8.44974 [0.8646055] Q( 20) = 11.5812 [0.9027371] H0 : No serial correlation ==> Accept H0 when prob. is High [Q < Chisq(lag)] -------------- Q-Statistics on Squared Standardized Residuals --> P-values adjusted by 2 degree(s) of freedom Q( 10) = 3.10750 [0.9274312] Q( 15) = 5.19410 [0.9706678] Q( 20) = 8.13497 [0.9765590] H0 : No serial correlation ==> Accept H0 when prob. is High [Q < Chisq(lag)] > > #Q3.cd > fit3c=garchOxFit(~arma(1,0),~gjr(1,1),sbux) Maximum Likelihood Estimation (Std.Errors based on Second derivatives) Coefficient Std.Error t-value t-prob Cst(M) 0.107669 0.043517 2.474 0.0135 AR(1) -0.085906 0.026286 -3.268 0.0011 Cst(V) 0.027612 0.010200 2.707 0.0069 ARCH(Alpha1) 0.000000 0.0043986 0.00 1.0000 GARCH(Beta1) 0.973904 0.0066043 147.5 0.0000 GJR(Gamma1) 0.039577 0.010540 3.755 0.0002 No. Observations : 1507 No. Parameters : 6 Mean (Y) : 0.07722 Variance (Y) : 4.30800 Skewness (Y) : 0.32455 Kurtosis (Y) : 7.33979 Log Likelihood : -3138.610 *************** ** FORECASTS ** *************** Number of Forecasts: 15 Horizon Mean Variance 1 0.1894 2.985 2 0.1006 2.994 3 0.1083 3.002 4 0.1076 3.01 5 0.1077 3.019 *********** ** TESTS ** *********** Statistic t-Test P-Value Skewness 0.33387 5.2964 1.1808e-007 Excess Kurtosis 3.5439 28.129 4.3867e-174 Jarque-Bera 816.60 .NaN 4.7632e-178 --------------- Q-Statistics on Standardized Residuals --> P-values adjusted by 1 degree(s) of freedom Q( 10) = 4.42143 [0.8815539] Q( 15) = 9.79175 [0.7772447] Q( 20) = 12.6511 [0.8559438] H0 : No serial correlation ==> Accept H0 when prob. is High [Q < Chisq(lag)] -------------- Q-Statistics on Squared Standardized Residuals --> P-values adjusted by 2 degree(s) of freedom Q( 10) = 3.81121 [0.8737427] Q( 15) = 5.85664 [0.9512149] Q( 20) = 9.44795 [0.9484455] H0 : No serial correlation ==> Accept H0 when prob. is High [Q < Chisq(lag)] > > #Q4 > data.Q4 = read.table("m-pg5606.txt", header=F) > pg = log(data.Q4[,2]+1)*100 > > #Q4.a > Box.test(pg,10) Box-Pierce test data: pg X-squared = 9.5527, df = 10, p-value = 0.4806 > > #Q4.bc > fit4b=garchOxFit(~arma(0,0),~garch(1,1),pg, cond.dist = "ged") Maximum Likelihood Estimation (Std.Errors based on Second derivatives) Coefficient Std.Error t-value t-prob Cst(M) 1.104123 0.15704 7.031 0.0000 Cst(V) 0.955237 0.48429 1.972 0.0490 ARCH(Alpha1) 0.106700 0.033391 3.195 0.0015 GARCH(Beta1) 0.846087 0.040814 20.73 0.0000 G.E.D.(DF) 1.428738 0.10329 13.83 0.0000 No. Observations : 612 No. Parameters : 5 Mean (Y) : 0.83891 Variance (Y) : 18.42440 Skewness (Y) : -0.73338 Kurtosis (Y) : 5.86810 Log Likelihood : -1732.141 Alpha[1]+Beta[1]: 0.95279 *************** ** FORECASTS ** *************** Number of Forecasts: 15 Horizon Mean Variance 1 1.104 8.421 2 1.104 8.979 3 1.104 9.51 4 1.104 10.02 5 1.104 10.5 *********** ** TESTS ** *********** Statistic t-Test P-Value Skewness -0.90815 9.1943 3.7736e-020 Excess Kurtosis 3.2178 16.315 7.7145e-060 Jarque-Bera 348.15 .NaN 2.5074e-076 --------------- Q-Statistics on Standardized Residuals Q( 10) = 6.88154 [0.7365789] Q( 15) = 10.6524 [0.7768265] Q( 20) = 18.2077 [0.5737306] H0 : No serial correlation ==> Accept H0 when prob. is High [Q < Chisq(lag)] -------------- Q-Statistics on Squared Standardized Residuals --> P-values adjusted by 2 degree(s) of freedom Q( 10) = 3.94305 [0.8622244] Q( 15) = 5.33224 [0.9671328] Q( 20) = 6.61925 [0.9929635] H0 : No serial correlation ==> Accept H0 when prob. is High [Q < Chisq(lag)] > > #Q5 > data.Q5 = read.table("d-exuseu.txt", header=F) > ex = diff(log(data.Q5[,4]))*100 > > #Q5.a > Box.test(ex,10) Box-Pierce test data: ex X-squared = 11.8792, df = 10, p-value = 0.2932 > > #Q5.b > Box.test(ex^2,10) Box-Pierce test data: ex^2 X-squared = 28.7667, df = 10, p-value = 0.001359 > > #Q5.cd > fit5c=garchOxFit(~arma(0,0),~igarch(1,1), ex) Maximum Likelihood Estimation (Std.Errors based on Second derivatives) Coefficient Std.Error t-value t-prob Cst(M) 0.011096 0.012800 0.8669 0.3861 Cst(V) 0.000000 0.00019736 0.00 1.0000 ARCH(Alpha1) 0.016029 0.0043496 3.685 0.0002 GARCH(Beta1) 0.984171 No. Observations : 2064 No. Parameters : 4 Mean (Y) : 0.00572 Variance (Y) : 0.36981 Skewness (Y) : 0.02196 Kurtosis (Y) : 3.76921 Log Likelihood : -1867.459 *************** ** FORECASTS ** *************** Number of Forecasts: 15 Horizon Mean Variance 1 0.0111 0.1406 2 0.0111 0.1406 3 0.0111 0.1406 4 0.0111 0.1406 5 0.0111 0.1406 *********** ** TESTS ** *********** Statistic t-Test P-Value Skewness 0.071359 1.3245 0.18534 Excess Kurtosis 0.66309 6.1567 7.4266e-010 Jarque-Bera 39.565 .NaN 2.5614e-009 --------------- Q-Statistics on Standardized Residuals Q( 10) = 9.60996 [0.4753530] Q( 15) = 15.4433 [0.4199806] Q( 20) = 20.6507 [0.4179448] H0 : No serial correlation ==> Accept H0 when prob. is High [Q < Chisq(lag)] -------------- Q-Statistics on Squared Standardized Residuals --> P-values adjusted by 2 degree(s) of freedom Q( 10) = 11.8262 [0.1591279] Q( 15) = 20.1528 [0.0914641] Q( 20) = 29.5518 [0.0420387] H0 : No serial correlation ==> Accept H0 when prob. is High [Q < Chisq(lag)]