Hw6 > aapl=aapl*100 > m1=garchOxFit(formula.mean=~arma(0,0),formula.var=~garch(1,1),series=aapl) ******************** ** SPECIFICATIONS ** ******************** Dependent variable : X Mean Equation : ARMA (0, 0) model. No regressor in the mean Variance Equation : GARCH (1, 1) model. No regressor in the variance The distribution is a Gauss distribution. Maximum Likelihood Estimation (Std.Errors based on Second derivatives) Coefficient Std.Error t-value t-prob Cst(M) 0.161516 0.059548 2.712 0.0067 Cst(V) 1.168892 0.30547 3.827 0.0001 ARCH(Alpha1) 0.170929 0.024999 6.837 0.0000 GARCH(Beta1) 0.758125 0.041961 18.07 0.0000 No. Observations : 2770 No. Parameters : 4 Mean (Y) : 0.08538 Variance (Y) : 13.00345 Skewness (Y) : -2.69295 Kurtosis (Y) : 67.35031 Log Likelihood : -7276.296 Alpha[1]+Beta[1]: 0.92885 *************** ** FORECASTS ** *************** Number of Forecasts: 15 Horizon Mean Variance 1 0.1615 9.488 2 0.1615 9.982 .... 15 0.1615 13.96 --------------- *********** ** TESTS ** *********** Statistic t-Test P-Value Skewness -0.30799 6.6213 3.5609e-011 Excess Kurtosis 14.721 158.30 0.00000 Jarque-Bera 25056. .NaN 0.00000 --------------- Information Criterium (to be minimized) Akaike 5.256531 Shibata 5.256527 Schwarz 5.265089 Hannan-Quinn 5.259622 --------------- Q-Statistics on Standardized Residuals Q( 10) = 17.4400 [0.0651781] Q( 15) = 21.6123 [0.1183804] Q( 20) = 30.1256 [0.0678433] 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) = 1.78246 [0.9869700] Q( 15) = 3.19642 [0.9971283] Q( 20) = 4.80780 [0.9991283] H0 : No serial correlation ==> Accept H0 when prob. is High [Q < Chisq(lag)] -------------- ARCH 1-2 test: F(2,2763)= 0.11923 [0.8876] ARCH 1-5 test: F(5,2757)= 0.13938 [0.9831] ARCH 1-10 test: F(10,2747)= 0.17677 [0.9978] *** t-dist > m2=garchOxFit(formula.mean=~arma(0,0),formula.var=~garch(1,1),series=aapl,cond.dist="t") ******************** ** SPECIFICATIONS ** ******************** Dependent variable : X Mean Equation : ARMA (0, 0) model. No regressor in the mean Variance Equation : GARCH (1, 1) model. No regressor in the variance The distribution is a Student distribution, with 4.75449 degrees of freedom. Maximum Likelihood Estimation (Std.Errors based on Second derivatives) Coefficient Std.Error t-value t-prob Cst(M) 0.066786 0.051640 1.293 0.1960 Cst(V) 0.704191 0.30283 2.325 0.0201 ARCH(Alpha1) 0.091618 0.026428 3.467 0.0005 GARCH(Beta1) 0.848600 0.047944 17.70 0.0000 Student(DF) 4.754489 0.40937 11.61 0.0000 No. Observations : 2770 No. Parameters : 5 Mean (Y) : 0.08538 Variance (Y) : 13.00345 Skewness (Y) : -2.69295 Kurtosis (Y) : 67.35031 Log Likelihood : -7036.267 Alpha[1]+Beta[1]: 0.94022 *************** ** FORECASTS ** *************** Number of Forecasts: 15 Horizon Mean Variance 1 0.06679 7.852 2 0.06679 8.086 ..... 15 0.06679 10.12 --------------- *********** ** TESTS ** *********** Statistic t-Test P-Value Skewness -0.63534 13.659 1.7962e-042 Excess Kurtosis 19.215 206.61 0.00000 Jarque-Bera 42798. .NaN 0.00000 --------------- Information Criterium (to be minimized) Akaike 5.083947 Shibata 5.083940 Schwarz 5.094645 Hannan-Quinn 5.087811 --------------- Q-Statistics on Standardized Residuals Q( 10) = 17.2427 [0.0691630] Q( 15) = 21.1628 [0.1317083] Q( 20) = 29.7114 [0.0746677] 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) = 1.24594 [0.9961669] Q( 15) = 2.52833 [0.9991705] Q( 20) = 3.35004 [0.9999359] **** > library(evir) > naapl=-aapl > m3=gev(naapl,block=21) > m3 $n.all [1] 2770 $n [1] 132 $data [1] 6.675965 4.752147 5.571358 2.444639 5.855115 7.583408 8.053783 [8] 3.468462 5.320037 5.436115 5.236756 3.857452 19.620955 5.918753 [15] 4.512290 4.196848 3.964560 2.935672 7.748598 10.734025 4.769976 [22] 10.215455 5.883747 11.163572 7.894581 3.648765 7.154971 5.310546 [29] 4.353400 2.931553 3.182096 7.387262 9.247720 8.555789 4.549958 [36] 9.335509 11.678104 5.926180 6.062087 4.586594 6.378147 3.789919 [43] 4.923226 2.636451 13.251477 6.704833 7.261370 6.804332 9.051569 [50] 7.919473 6.591547 8.915914 6.935008 4.882266 9.543219 7.354967 [57] 8.270792 73.124373 6.044026 17.208216 4.619055 8.154634 8.365338 [64] 6.457052 6.325934 8.198042 18.839194 3.159387 8.200213 5.830731 [71] 4.596017 4.493461 4.338778 7.498220 3.120175 4.711257 5.312655 [78] 16.295432 13.337141 4.862318 2.972752 4.038459 7.348509 3.440513 [85] 4.171823 3.523347 4.290750 8.492628 3.794073 2.945971 2.586155 [92] 3.991615 5.075660 6.534952 4.376382 3.507811 5.740668 3.455004 [99] 4.111370 4.039500 2.204113 3.850177 3.141843 5.265211 2.909931 [106] 2.542038 3.880320 4.492415 6.593683 5.427669 5.332694 9.663205 [113] 4.600205 5.010453 2.661095 3.044890 4.516474 4.642097 2.264446 [120] 4.041583 4.501829 6.538154 3.466391 2.525627 4.233355 3.854334 [127] 4.954745 3.682997 2.792634 2.396488 2.307417 3.155259 $block [1] 21 $par.ests xi sigma mu 0.3517411 1.7753883 4.2818100 $par.ses xi sigma mu 0.08118587 0.15421383 0.17771414 $varcov [,1] [,2] [,3] [1,] 0.0065911454 0.0000961704 -0.00431687 [2,] 0.0000961704 0.0237819042 0.01841563 [3,] -0.0043168698 0.0184156278 0.03158231 $converged [1] 0 $nllh.final [1] 310.3605 attr(,"class") [1] "gev" > p1=(1-.01)^{21} > qgev(p1,xi=0.3517411,sigma=1.773883,mu=4.28181) [1] 7.955081 *** > meplot(naapl) > idx=ifelse(naapl>5,1,0) > sum(idx) [1] 131 > idx=ifelse(naapl>6,1,0) > sum(idx) [1] 83 > m4=gpd(naapl,threshold=5.0) > m4 $n [1] 2770 $data [1] 5.567128 6.257778 6.675965 6.402665 5.022019 6.425056 5.571358 [8] 5.855115 5.406555 7.583408 8.053783 5.320037 5.436115 5.236756 [15] 6.130110 19.620955 5.918753 7.748598 7.092688 8.487185 8.765158 [22] 10.734025 10.215455 6.608639 7.410951 6.924290 5.883747 5.195667 [29] 11.163572 7.894581 7.154971 5.310546 5.273644 7.387262 9.247720 [36] 9.184120 6.606502 8.555789 6.020658 9.335509 6.639625 5.129329 [43] 11.678104 5.926180 5.013607 5.925119 5.798935 6.062087 6.378147 [50] 5.465684 6.131173 13.251477 10.487175 5.743845 5.553385 6.704833 [57] 7.261370 6.804332 8.807740 9.051569 5.250455 6.184349 7.919473 [64] 6.591547 5.998358 7.789668 5.258887 8.915914 5.609427 5.316874 [71] 5.984555 6.353636 6.935008 6.033404 8.304471 9.543219 7.354967 [78] 6.620391 5.171444 7.408797 8.270792 73.124373 6.001543 8.327292 [85] 6.842874 6.174775 6.608639 6.082277 7.647076 6.044026 5.734314 [92] 6.240746 17.208216 8.154634 5.441395 5.981370 8.365338 5.449843 [99] 6.457052 6.325934 5.834971 8.198042 6.191796 5.131435 7.119530 [106] 18.839194 8.200213 5.690903 5.830731 5.731137 5.504770 7.307620 [113] 7.498220 5.312655 16.295432 13.337141 5.684552 7.348509 8.492628 [120] 5.075660 6.534952 5.740668 5.265211 6.593683 5.427669 5.332694 [127] 9.663205 5.262049 5.010453 6.538154 5.773505 $threshold [1] 5 $p.less.thresh [1] 0.9527076 $n.exceed [1] 131 $method [1] "ml" $par.ests xi beta 0.288860 1.783772 $par.ses xi beta 0.09169013 0.22139885 $varcov [,1] [,2] [1,] 0.00840708 -0.00993104 [2,] -0.00993104 0.04901745 $information [1] "observed" $converged [1] 0 $nllh.final [1] 244.6741 attr(,"class") [1] "gpd" > riskmetrics(m4,c(.95,.99,.999)) Error: could not find function "riskmetrics" > riskmeasures(m4,c(.95,.99,.999)) p quantile sfall [1,] 0.950 4.901486 7.369798 [2,] 0.990 8.498032 12.427235 [3,] 0.999 17.636666 25.277917 > > m4=gpd(naapl,threshold=6.0) > riskmeasures(m4,c(.95,.99,.999)) p quantile sfall [1,] 0.950 5.294246 7.493871 [2,] 0.990 8.174472 12.651316 [3,] 0.999 18.162864 30.536919 > m4 $n [1] 2770 $data [1] 6.257778 6.675965 6.402665 6.425056 7.583408 8.053783 6.130110 [8] 19.620955 7.748598 7.092688 8.487185 8.765158 10.734025 10.215455 [15] 6.608639 7.410951 6.924290 11.163572 7.894581 7.154971 7.387262 [22] 9.247720 9.184120 6.606502 8.555789 6.020658 9.335509 6.639625 [29] 11.678104 6.062087 6.378147 6.131173 13.251477 10.487175 6.704833 [36] 7.261370 6.804332 8.807740 9.051569 6.184349 7.919473 6.591547 [43] 7.789668 8.915914 6.353636 6.935008 6.033404 8.304471 9.543219 [50] 7.354967 6.620391 7.408797 8.270792 73.124373 6.001543 8.327292 [57] 6.842874 6.174775 6.608639 6.082277 7.647076 6.044026 6.240746 [64] 17.208216 8.154634 8.365338 6.457052 6.325934 8.198042 6.191796 [71] 7.119530 18.839194 8.200213 7.307620 7.498220 16.295432 13.337141 [78] 7.348509 8.492628 6.534952 6.593683 9.663205 6.538154 $threshold [1] 6 $p.less.thresh [1] 0.9700361 $n.exceed [1] 83 $method [1] "ml" $par.ests xi beta 0.4415401 1.5400211 $par.ses xi beta 0.1454886 0.2705443 $varcov [,1] [,2] [1,] 0.02116694 -0.02078067 [2,] -0.02078067 0.07319421 $information [1] "observed" $converged [1] 0 $nllh.final [1] 155.4753 attr(,"class") [1] "gpd" > > m4=gpd(naapl,threshold=4.0) > m4 $n [1] 2770 $data [1] 5.567128 6.257778 6.675965 6.402665 5.022019 6.425056 4.752147 [8] 5.571358 4.299101 5.855115 5.406555 7.583408 8.053783 4.779416 [15] 4.965254 4.012432 5.320037 4.445358 4.145761 5.436115 5.236756 [22] 6.130110 4.106161 19.620955 5.918753 4.512290 4.196848 7.748598 [29] 7.092688 8.487185 8.765158 10.734025 4.769976 10.215455 6.608639 [36] 7.410951 4.475681 6.924290 5.883747 5.195667 4.167653 11.163572 [43] 7.894581 7.154971 5.310546 4.353400 5.273644 4.306409 7.387262 [50] 9.247720 9.184120 6.606502 8.555789 6.020658 4.182249 4.549958 [57] 9.335509 6.639625 5.129329 11.678104 4.409819 4.369069 5.926180 [64] 4.212493 5.013607 5.925119 4.687151 4.133254 5.798935 6.062087 [71] 4.586594 4.509151 6.378147 5.465684 4.003064 6.131173 4.658859 [78] 4.923226 4.557285 4.239615 13.251477 10.487175 5.743845 5.553385 [85] 6.704833 7.261370 6.804332 4.471498 4.256309 4.130128 8.807740 [92] 9.051569 5.250455 6.184349 4.654668 7.919473 4.275094 4.183292 [99] 4.281356 6.591547 5.998358 7.789668 4.605441 4.060327 5.258887 [106] 4.552052 8.915914 4.637907 5.609427 5.316874 4.350267 5.984555 [113] 6.353636 4.165568 6.935008 4.418180 4.695535 4.154100 4.882266 [120] 4.394144 4.487185 6.033404 4.117622 8.304471 9.543219 7.354967 [127] 4.273006 6.620391 5.171444 7.408797 8.270792 4.982069 73.124373 [134] 6.001543 8.327292 6.842874 4.106161 6.174775 6.608639 6.082277 [141] 7.647076 6.044026 5.734314 4.502875 6.240746 17.208216 4.112412 [148] 4.619055 8.154634 5.441395 5.981370 8.365338 4.348178 5.449843 [155] 6.457052 4.469406 4.972610 6.325934 4.172866 5.834971 8.198042 [162] 6.191796 5.131435 7.119530 18.839194 4.073866 4.577172 4.268832 [169] 8.200213 5.690903 5.830731 4.737467 5.731137 4.596017 4.212493 [176] 4.493461 4.338778 4.332512 5.504770 7.307620 7.498220 4.711257 [183] 5.312655 4.177036 4.865467 16.295432 4.470452 13.337141 4.181207 [190] 5.684552 4.477772 4.862318 4.038459 7.348509 4.387874 4.171823 [197] 4.290750 8.492628 5.075660 4.263614 6.534952 4.376382 5.740668 [204] 4.111370 4.039500 5.265211 4.492415 6.593683 5.427669 5.332694 [211] 4.250049 9.663205 5.262049 4.353400 4.624291 4.244832 4.600205 [218] 5.010453 4.516474 4.642097 4.041583 4.278225 4.501829 6.538154 [225] 5.773505 4.233355 4.954745 $threshold [1] 4 $p.less.thresh [1] 0.9180505 $n.exceed [1] 227 $method [1] "ml" $par.ests xi beta 0.2742367 1.5965528 $par.ses xi beta 0.07565552 0.15801286 $varcov [,1] [,2] [1,] 0.005723757 -0.006677748 [2,] -0.006677748 0.024968065 $information [1] "observed" $converged [1] 0 $nllh.final [1] 395.4303 attr(,"class") [1] "gpd" > riskmeasures(m4,c(.95,.99,.999)) p quantile sfall [1,] 0.950 4.844763 7.36379 [2,] 0.990 8.543583 12.46025 [3,] 0.999 17.668663 25.03333 > > da=read.table("d-aapl9606.txt") > aapl=log(da[,2]+1)*100 > da=read.table("d-aig9606.txt") > aig=log(da[,2]+1)*100 > cor(aig,aapl) [1] 0.1520265