Hieronder staat het script waarmee de Ljung-Box test is afgenomen voor de set, de p-waardes voor de sets zijn gevonden, waarmee de ARMA-modellen en alle mogelijke type GARCH-modellen zijn geprobeerd. Q1.3<-matrix(NA,nrow=32,ncol=1) Q1.4<-matrix(NA,nrow=32,ncol=1) Q1.5<-matrix(NA,nrow=32,ncol=1) for (i in 1:32){ Q1.3[i] <- Box.test(robusta$X3rd,lag=i,type="Ljung-Box")$p.value Q1.4[i] <- Box.test(robusta$X4th,lag=i,type="Ljung-Box")$p.value Q1.5[i] <- Box.test(robusta$X5th,lag=i,type="Ljung-Box")$p.value } adf.test(robusta$X3rd) Augmented Dickey-Fuller Test data: robusta$X3rd Dickey-Fuller = -1.882, Lag order = 10, p-value = 0.6283 alternative hypothesis: stationary adf.test(diff(robusta$X3rd,lag=1)) Augmented Dickey-Fuller Test data: diff(robusta$X3rd, lag = 1) Dickey-Fuller = -10.7103, Lag order = 10, p-value = 0.01 alternative hypothesis: stationary Warning message: In adf.test(diff(robusta$X3rd, lag = 1)) : p-value smaller than printed p-value adf.test(robusta$X4th) Augmented Dickey-Fuller Test data: robusta$X4th Dickey-Fuller = -1.7981, Lag order = 10, p-value = 0.6638 alternative hypothesis: stationary adf.test(diff(robusta$X4th,lag=1)) Augmented Dickey-Fuller Test data: diff(robusta$X4th, lag = 1) Dickey-Fuller = -10.7435, Lag order = 10, p-value = 0.01 alternative hypothesis: stationary Warning message: In adf.test(diff(robusta$X4th, lag = 1)) : p-value smaller than printed p-value adf.test(robusta$X5th) Augmented Dickey-Fuller Test data: robusta$X5th Dickey-Fuller = -1.7731, Lag order = 10, p-value = 0.6743 alternative hypothesis: stationary adf.test(diff(robusta$X5th,lag=1)) Augmented Dickey-Fuller Test data: diff(robusta$X5th, lag = 1) Dickey-Fuller = -10.7174, Lag order = 10, p-value = 0.01 alternative hypothesis: stationary Warning message: In adf.test(diff(robusta$X5th, lag = 1)) : p-value smaller than printed p-value PP.test(robusta$X3rd) Phillips-Perron Unit Root Test data: robusta$X3rd Dickey-Fuller = -1.8833, Truncation lag parameter = 7, p-value = 0.6277 PP.test(diff(robusta$X3rd,lag=1)) Phillips-Perron Unit Root Test data: diff(robusta$X3rd, lag = 1) Dickey-Fuller = -32.9293, Truncation lag parameter = 7, p-value = 0.01 PP.test(robusta$X4th) Phillips-Perron Unit Root Test data: robusta$X4th Dickey-Fuller = -1.8207, Truncation lag parameter = 7, p-value = 0.6542 PP.test(diff(robusta$X4th,lag=1)) Phillips-Perron Unit Root Test data: diff(robusta$X4th, lag = 1) Dickey-Fuller = -33.2036, Truncation lag parameter = 7, p-value = 0.01 PP.test(robusta$X5th) Phillips-Perron Unit Root Test data: robusta$X5th Dickey-Fuller = -1.7874, Truncation lag parameter = 7, p-value = 0.6683 PP.test(diff(robusta$X5th,lag=1)) Phillips-Perron Unit Root Test data: diff(robusta$X5th, lag = 1) Dickey-Fuller = -33.3588, Truncation lag parameter = 7, p-value = 0.01 Q2.3<-matrix(NA,nrow=32,ncol=1) Q2.4<-matrix(NA,nrow=32,ncol=1) Q2.5<-matrix(NA,nrow=32,ncol=1) for (i in 1:32){ Q2.3[i] <- Box.test(diff(robusta$X3rd,lag=1),lag=i,type="Ljung-Box")$p.value Q2.4[i] <- Box.test(diff(robusta$X4th,lag=1),lag=i,type="Ljung-Box")$p.value Q2.5[i] <- Box.test(diff(robusta$X5th,lag=1),lag=i,type="Ljung-Box")$p.value } par(mfrow=c(2,1)) plot(Q1.3,main="p-waardes behorende bij de ACF van de robusta-set, 3 maanden",ylim=c(-0.1,0.1),col="blue") plot(Q2.3,main="p-waardes behorende bij de ACF van de robusta-set, 3 maanden, met lag=1",ylim=c(-0.1,0.1),col="red") par(mfrow=c(2,1)) plot(Q1.4,main="p-waardes behorende bij de ACF van de robusta-set, 4 maanden",ylim=c(-0.1,0.1),col="blue") plot(Q2.4,main="p-waardes behorende bij de ACF van de robusta-set, 4 maanden, met lag=1",ylim=c(-0.1,0.1),col="red") par(mfrow=c(2,1)) plot(Q1.5,main="p-waardes behorende bij de ACF van de robusta-set, 5 maanden",ylim=c(-0.1,0.1),col="blue") plot(Q2.5,main="p-waardes behorende bij de ACF van de robusta-set, 5 maanden, met lag=1",ylim=c(-0.1,0.1),col="red") arburg1.3<-ar.burg(x=diff(robusta$X3rd,lag=1),aic=TRUE) arburg2.3<-ar.burg(x=diff(robusta$X3rd,lag=1),aic=FALSE) armle1.3<-ar.mle(x=diff(robusta$X3rd,lag=1),aic=TRUE) armle2.3<-ar.mle(x=diff(robusta$X3rd,lag=1),aic=FALSE) arols1.3<-ar.ols(x=diff(robusta$X3rd,lag=1),aic=TRUE) arols2.3<-ar.ols(x=diff(robusta$X3rd,lag=1),aic=FALSE) aryw1.3<-ar.yw(x=diff(robusta$X3rd,lag=1),aic=TRUE) aryw2.3<-ar.yw(x=diff(robusta$X3rd,lag=1),aic=FALSE) arburg1.3$order;arburg2.3$order [1] 17 [1] 31 armle1.3$order;armle2.3$order [1] 1 [1] 12 arols1.3$order;arols2.3$order [1] 1 [1] 31 aryw1.3$order;aryw2.3$order [1] 17 [1] 31 porde.3<- c(0,armle1.3$order,armle2.3$order,arburg1.3$order,arburg2.3$order) qmax<- 10 Matrix.3 <- matrix(NA,nrow=qmax*(length(porde.3)),ncol=7) for (j in 1:length(porde.3)){p=porde.3[j]; for (q in 1:qmax+1){ i=1;q=q-1; teller=(q+1)+(qmax*(j-1)); n=length(robusta$X3rd)-i myfit <- arima(x=robusta$X3rd,order=c(p,i,q),include.mean=F) loglik <- myfit$loglik theaic <- aic(myfit$loglik,p,q,n) theaicc <- aicc(myfit$loglik,p,q,n) thebic <- bic(myfit$loglik,p,q,n) Matrix.3[teller,1]=p; Matrix.3[teller,2]=i; Matrix.3[teller,3]=q; Matrix.3[teller,4]=loglik; Matrix.3[teller,5]=theaic; Matrix.3[teller,6]=theaicc;Matrix.3[teller,7]=thebic; } } for (i in 45:50){ Matrix.3[i,1]=31;Matrix.3[i,2]=1; Matrix.3[i,3]=i-41;Matrix.3[i,4]=-Inf Matrix.3[i,5]=Inf;Matrix.3[i,6]=Inf; Matrix.3[i,7]=Inf } myfit<-arima(x=robusta$X3rd,order=c(0,1,0),include.mean=F) Matrix.3[1,1]=0;Matrix.3[1,2]=1; Matrix.3[1,3]=0;Matrix.3[1,4]=myfit$loglik; Matrix.3[1,5]=aic(Matrix.3[1,4],Matrix.3[1,1],Matrix.3[1,3],length(robusta$X3rd)-1) Matrix.3[1,6]=aicc(Matrix.3[1,4],Matrix.3[1,1],Matrix.3[1,3],length(robusta$X3rd)-1) Matrix.3[1,7]=bic(Matrix.3[1,4],Matrix.3[1,1],Matrix.3[1,3],length(robusta$X3rd)-1) arburg1.4<-ar.burg(x=diff(robusta$X4th,lag=1),aic=TRUE) arburg2.4<-ar.burg(x=diff(robusta$X4th,lag=1),aic=FALSE) armle1.4<-ar.mle(x=diff(robusta$X4th,lag=1),aic=TRUE) armle2.4<-ar.mle(x=diff(robusta$X4th,lag=1),aic=FALSE) arols1.4<-ar.ols(x=diff(robusta$X4th,lag=1),aic=TRUE) arols2.4<-ar.ols(x=diff(robusta$X4th,lag=1),aic=FALSE) aryw1.4<-ar.yw(x=diff(robusta$X4th,lag=1),aic=TRUE) aryw2.4<-ar.yw(x=diff(robusta$X4th,lag=1),aic=FALSE) arburg1.4$order;arburg2.4$order [1] 1 [1] 31 armle1.4$order;armle2.4$order [1] 1 [1] 12 arols1.4$order;arols2.4$order [1] 1 [1] 31 aryw1.4$order;aryw2.4$order [1] 1 [1] 31 porde.4<- c(0,armle1.4$order,armle2.4$order,arburg2.4$order) qmax<- 10 Matrix.4 <- matrix(NA,nrow=qmax*(length(porde.4)),ncol=7) for (j in 1:length(porde.4)){p=porde.4[j]; for (q in 1:qmax+1){ i=1;q=q-1; teller=(q+1)+(qmax*(j-1)); n=length(robusta$X4th)-i myfit <- arima(x=robusta$X4th,order=c(p,i,q),include.mean=F) loglik <- myfit$loglik theaic <- aic(myfit$loglik,p,q,n) theaicc <- aicc(myfit$loglik,p,q,n) thebic <- bic(myfit$loglik,p,q,n) Matrix.4[teller,1]=p; Matrix.4[teller,2]=i; Matrix.4[teller,3]=q; Matrix.4[teller,4]=loglik; Matrix.4[teller,5]=theaic; Matrix.4[teller,6]=theaicc;Matrix.4[teller,7]=thebic; } } for (i in 39:40){ Matrix.4[i,1]=31;Matrix.4[i,2]=1; Matrix.4[i,3]=i-31;Matrix.4[i,4]=-Inf Matrix.4[i,5]=Inf;Matrix.4[i,6]=Inf; Matrix.4[i,7]=Inf } myfit<-arima(x=robusta$X4th,order=c(0,1,0),include.mean=F) Matrix.4[1,1]=0;Matrix.4[1,2]=1; Matrix.4[1,3]=0;Matrix.4[1,4]=myfit$loglik; Matrix.4[1,5]=aic(Matrix.4[1,4],Matrix.4[1,1],Matrix.4[1,3],length(robusta$X4th)-1) Matrix.4[1,6]=aicc(Matrix.4[1,4],Matrix.4[1,1],Matrix.4[1,3],length(robusta$X4th)-1) Matrix.4[1,7]=bic(Matrix.4[1,4],Matrix.4[1,1],Matrix.4[1,3],length(robusta$X4th)-1) arburg1.5<-ar.burg(x=diff(robusta$X5th,lag=1),aic=TRUE) arburg2.5<-ar.burg(x=diff(robusta$X5th,lag=1),aic=FALSE) armle1.5<-ar.mle(x=diff(robusta$X5th,lag=1),aic=TRUE) armle2.5<-ar.mle(x=diff(robusta$X5th,lag=1),aic=FALSE) arols1.5<-ar.ols(x=diff(robusta$X5th,lag=1),aic=TRUE) arols2.5<-ar.ols(x=diff(robusta$X5th,lag=1),aic=FALSE) aryw1.5<-ar.yw(x=diff(robusta$X5th,lag=1),aic=TRUE) aryw2.5<-ar.yw(x=diff(robusta$X5th,lag=1),aic=FALSE) arburg1.5$order;arburg2.5$order [1] 1 [1] 31 armle1.5$order;armle2.5$order [1] 1 [1] 12 arols1.5$order;arols2.5$order [1] 1 [1] 31 aryw1.5$order;aryw2.5$order [1] 1 [1] 31 porde.5<- c(0,armle1.5$order,armle2.5$order,arburg2.5$order) qmax<- 10 Matrix.5 <- matrix(NA,nrow=qmax*(length(porde.5)),ncol=7) for (j in 1:length(porde.5)){p=porde.5[j]; for (q in 1:qmax+1){ i=1;q=q-1; teller=(q+1)+(qmax*(j-1)); n=length(robusta$X5th)-i myfit <- arima(x=robusta$X5th,order=c(p,i,q),include.mean=F) loglik <- myfit$loglik theaic <- aic(myfit$loglik,p,q,n) theaicc <- aicc(myfit$loglik,p,q,n) thebic <- bic(myfit$loglik,p,q,n) Matrix.5[teller,1]=p; Matrix.5[teller,2]=i; Matrix.5[teller,3]=q; Matrix.5[teller,4]=loglik; Matrix.5[teller,5]=theaic; Matrix.5[teller,6]=theaicc;Matrix.5[teller,7]=thebic; } } for (i in 39:40){ Matrix.5[i,1]=31;Matrix.5[i,2]=1; Matrix.5[i,3]=i-31;Matrix.5[i,4]=-Inf Matrix.5[i,5]=Inf;Matrix.5[i,6]=Inf; Matrix.5[i,7]=Inf } myfit<-arima(x=robusta$X5th,order=c(0,1,0),include.mean=F) Matrix.5[1,1]=0;Matrix.5[1,2]=1; Matrix.5[1,3]=0;Matrix.5[1,4]=myfit$loglik; Matrix.5[1,5]=aic(Matrix.5[1,4],Matrix.5[1,1],Matrix.5[1,3],length(robusta$X5th)-1) Matrix.5[1,6]=aicc(Matrix.5[1,4],Matrix.5[1,1],Matrix.5[1,3],length(robusta$X5th)-1) Matrix.5[1,7]=bic(Matrix.5[1,4],Matrix.5[1,1],Matrix.5[1,3],length(robusta$X5th)-1) min(Matrix.3[,5]);min(Matrix.3[,6]);min(Matrix.3[,7]); [1] 12519.08 [1] 12519.82 [1] 12534.17 min(Matrix.4[,5]);min(Matrix.4[,6]);min(Matrix.4[,7]); [1] 12391.51 [1] 12391.52 [1] 12400.36 min(Matrix.5[,5]);min(Matrix.5[,6]);min(Matrix.5[,7]); [1] 12348.89 [1] 12348.9 [1] 12357 pmaxi=8;qmaxi=8 Matrix2.3rd.1.s=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in 1:(pmaxi+1)){ p=p-1; for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X3rd,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="sGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(17,3))); fit=ugarchfit(spec=spec,data=diff(robusta$X3rd,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p+17,q+3,n) theaicc <- aicc(loglik,p+17,q+3,n) thebic <- bic(loglik,p+17,q+3,n) Matrix2.3rd.1.s[teller,1]=p;Matrix2.3rd.1.s[teller,2]=q; Matrix2.3rd.1.s[teller,3]=loglik;Matrix2.3rd.1.s[teller,4]=theaic; Matrix2.3rd.1.s[teller,5]=theaicc;Matrix2.3rd.1.s[teller,6]=thebic; } } pmaxi=8;qmaxi=8 Matrix2.4th.1.s=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in 1:(pmaxi+1)){ p=p-1; for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X4th,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="sGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(0,1))); fit=ugarchfit(spec=spec,data=diff(robusta$X4th,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p,q+1,n) theaicc <- aicc(loglik,p,q+1,n) thebic <- bic(loglik,p,q+1,n) Matrix2.4th.1.s[teller,1]=p;Matrix2.4th.1.s[teller,2]=q; Matrix2.4th.1.s[teller,3]=loglik;Matrix2.4th.1.s[teller,4]=theaic; Matrix2.4th.1.s[teller,5]=theaicc;Matrix2.4th.1.s[teller,6]=thebic; } } pmaxi=8;qmaxi=8 Matrix2.5th.1.s=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in 1:(pmaxi+1)){ p=p-1; for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X5th,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="sGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(0,1))); fit=ugarchfit(spec=spec,data=diff(robusta$X5th,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p,q+1,n) theaicc <- aicc(loglik,p,q+1,n) thebic <- bic(loglik,p,q+1,n) Matrix2.5th.1.s[teller,1]=p;Matrix2.5th.1.s[teller,2]=q; Matrix2.5th.1.s[teller,3]=loglik;Matrix2.5th.1.s[teller,4]=theaic; Matrix2.5th.1.s[teller,5]=theaicc;Matrix2.5th.1.s[teller,6]=thebic; } } pmaxi=8;qmaxi=8 Matrix2.3rd.1.i=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in 1:(pmaxi+1)){ p=p-1; for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X3rd,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="iGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(17,3))); fit=ugarchfit(spec=spec,data=diff(robusta$X3rd,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p+17,q+3,n) theaicc <- aicc(loglik,p+17,q+3,n) thebic <- bic(loglik,p+17,q+3,n) Matrix2.3rd.1.i[teller,1]=p;Matrix2.3rd.1.i[teller,2]=q; Matrix2.3rd.1.i[teller,3]=loglik;Matrix2.3rd.1.i[teller,4]=theaic; Matrix2.3rd.1.i[teller,5]=theaicc;Matrix2.3rd.1.i[teller,6]=thebic; } } pmaxi=8;qmaxi=8 Matrix2.4th.1.i=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in 1:(pmaxi+1)){ p=p-1; for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X4th,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="iGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(0,1))); fit=ugarchfit(spec=spec,data=diff(robusta$X4th,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p,q+1,n) theaicc <- aicc(loglik,p,q+1,n) thebic <- bic(loglik,p,q+1,n) Matrix2.4th.1.i[teller,1]=p;Matrix2.4th.1.i[teller,2]=q; Matrix2.4th.1.i[teller,3]=loglik;Matrix2.4th.1.i[teller,4]=theaic; Matrix2.4th.1.i[teller,5]=theaicc;Matrix2.4th.1.i[teller,6]=thebic; } } pmaxi=8;qmaxi=8 Matrix2.5th.1.i=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in 1:(pmaxi+1)){ p=p-1; for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X5th,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="iGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(0,1))); fit=ugarchfit(spec=spec,data=diff(robusta$X5th,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p,q+1,n) theaicc <- aicc(loglik,p,q+1,n) thebic <- bic(loglik,p,q+1,n) Matrix2.5th.1.i[teller,1]=p;Matrix2.5th.1.i[teller,2]=q; Matrix2.5th.1.i[teller,3]=loglik;Matrix2.5th.1.i[teller,4]=theaic; Matrix2.5th.1.i[teller,5]=theaicc;Matrix2.5th.1.i[teller,6]=thebic; } } qmaxi=6 Matrix2.3rd.1.ap=matrix(NA,nrow=qmaxi,ncol=6) for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X3rd,lag=1)); teller=q spec=ugarchspec(variance.model=list(model="apARCH",garchOrder=c(0,q)), mean.model=list(armaOrder=c(17,3))); fit=ugarchfit(spec=spec,data=diff(robusta$X3rd,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,17,q+3,n) theaicc <- aicc(loglik,17,q+3,n) thebic <- bic(loglik,17,q+3,n) Matrix2.3rd.1.ap[teller,1]=0;Matrix2.3rd.1.ap[teller,2]=q; Matrix2.3rd.1.ap[teller,3]=loglik;Matrix2.3rd.1.ap[teller,4]=theaic; Matrix2.3rd.1.ap[teller,5]=theaicc;Matrix2.3rd.1.ap[teller,6]=thebic; } qmaxi=6 Matrix2.4th.1.ap=matrix(NA,nrow=qmaxi,ncol=6) for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X4th,lag=1)); teller=q spec=ugarchspec(variance.model=list(model="apARCH",garchOrder=c(0,q)), mean.model=list(armaOrder=c(0,1))); fit=ugarchfit(spec=spec,data=diff(robusta$X4th,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,0,q+1,n) theaicc <- aicc(loglik,0,q+1,n) thebic <- bic(loglik,0,q+1,n) Matrix2.4th.1.ap[teller,1]=0;Matrix2.4th.1.ap[teller,2]=q; Matrix2.4th.1.ap[teller,3]=loglik;Matrix2.4th.1.ap[teller,4]=theaic; Matrix2.4th.1.ap[teller,5]=theaicc;Matrix2.4th.1.ap[teller,6]=thebic; } qmaxi=6 Matrix2.5th.1.ap=matrix(NA,nrow=qmaxi,ncol=6) for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X5th,lag=1)); teller=q spec=ugarchspec(variance.model=list(model="apARCH",garchOrder=c(0,q)), mean.model=list(armaOrder=c(0,1))); fit=ugarchfit(spec=spec,data=diff(robusta$X5th,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,0,q+1,n) theaicc <- aicc(loglik,0,q+1,n) thebic <- bic(loglik,0,q+1,n) Matrix2.5th.1.ap[teller,1]=0;Matrix2.5th.1.ap[teller,2]=q; Matrix2.5th.1.ap[teller,3]=loglik;Matrix2.5th.1.ap[teller,4]=theaic; Matrix2.5th.1.ap[teller,5]=theaicc;Matrix2.5th.1.ap[teller,6]=thebic; } pmaxi=8;qmaxi=8 Matrix2.3rd.2.t=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in (pmaxi+1):(pmaxi+1)){ p=p-1; for (q in 7:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X3rd,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="fGARCH",submodel="TGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(17,3))); fit=ugarchfit(spec=spec,data=diff(robusta$X3rd,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p+17,q+3,n) theaicc <- aicc(loglik,p+17,q+3,n) thebic <- bic(loglik,p+17,q+3,n) Matrix2.3rd.2.t[teller,1]=p;Matrix2.3rd.2.t[teller,2]=q; Matrix2.3rd.2.t[teller,3]=loglik;Matrix2.3rd.2.t[teller,4]=theaic; Matrix2.3rd.2.t[teller,5]=theaicc;Matrix2.3rd.2.t[teller,6]=thebic; } } for (i in 66:72){ Matrix2.3rd.2.t[i,1]=8;Matrix2.3rd.2.t[i,2]=i-64; Matrix2.3rd.2.t[i,3]=-Inf;Matrix2.3rd.2.t[i,4]=Inf; Matrix2.3rd.2.t[i,5]=Inf;Matrix2.3rd.2.t[i,6]=Inf; } pmaxi=8;qmaxi=8 Matrix2.4th.2.t=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in 1:(pmaxi+1)){ p=p-1; for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X4th,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="fGARCH",submodel="TGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(0,1))); fit=ugarchfit(spec=spec,data=diff(robusta$X4th,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p,q+1,n) theaicc <- aicc(loglik,p,q+1,n) thebic <- bic(loglik,p,q+1,n) Matrix2.4th.2.t[teller,1]=p;Matrix2.4th.2.t[teller,2]=q; Matrix2.4th.2.t[teller,3]=loglik;Matrix2.4th.2.t[teller,4]=theaic; Matrix2.4th.2.t[teller,5]=theaicc;Matrix2.4th.2.t[teller,6]=thebic; } } for (i in 66:72){ Matrix2.4th.2.t[i,1]=8;Matrix2.4th.2.t[i,2]=i-64; Matrix2.4th.2.t[i,3]=-Inf;Matrix2.4th.2.t[i,4]=Inf; Matrix2.4th.2.t[i,5]=Inf;Matrix2.4th.2.t[i,6]=Inf; } pmaxi=8;qmaxi=8 Matrix2.5th.2.t=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in 1:(pmaxi+1)){ p=p-1; for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X5th,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="fGARCH",submodel="TGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(0,1))); fit=ugarchfit(spec=spec,data=diff(robusta$X5th,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p,q+1,n) theaicc <- aicc(loglik,p,q+1,n) thebic <- bic(loglik,p,q+1,n) Matrix2.5th.2.t[teller,1]=p;Matrix2.5th.2.t[teller,2]=q; Matrix2.5th.2.t[teller,3]=loglik;Matrix2.5th.2.t[teller,4]=theaic; Matrix2.5th.2.t[teller,5]=theaicc;Matrix2.5th.2.t[teller,6]=thebic; } } for (i in 66:72){ Matrix2.5th.2.t[i,1]=8;Matrix2.5th.2.t[i,2]=i-64; Matrix2.5th.2.t[i,3]=-Inf;Matrix2.5th.2.t[i,4]=Inf; Matrix2.5th.2.t[i,5]=Inf;Matrix2.5th.2.t[i,6]=Inf; } pmaxi=8;qmaxi=8 Matrix2.3rd.2.av=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in 1:(pmaxi+1)){ p=p-1; for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X3rd,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="fGARCH",submodel="AVGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(17,3))); fit=ugarchfit(spec=spec,data=diff(robusta$X3rd,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p+17,q+3,n) theaicc <- aicc(loglik,p+17,q+3,n) thebic <- bic(loglik,p+17,q+3,n) Matrix2.3rd.2.av[teller,1]=p;Matrix2.3rd.2.av[teller,2]=q; Matrix2.3rd.2.av[teller,3]=loglik;Matrix2.3rd.2.av[teller,4]=theaic; Matrix2.3rd.2.av[teller,5]=theaicc;Matrix2.3rd.2.av[teller,6]=thebic; } } pmaxi=8;qmaxi=8 Matrix2.4th.2.av=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in 1:(pmaxi+1)){ p=p-1; for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X4th,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="fGARCH",submodel="AVGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(0,1))); fit=ugarchfit(spec=spec,data=diff(robusta$X4th,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p,q+1,n) theaicc <- aicc(loglik,p,q+1,n) thebic <- bic(loglik,p,q+1,n) Matrix2.4th.2.av[teller,1]=p;Matrix2.4th.2.av[teller,2]=q; Matrix2.4th.2.av[teller,3]=loglik;Matrix2.4th.2.av[teller,4]=theaic; Matrix2.4th.2.av[teller,5]=theaicc;Matrix2.4th.2.av[teller,6]=thebic; } } pmaxi=8;qmaxi=8 Matrix2.5th.2.av=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in 1:(pmaxi+1)){ p=p-1; for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X5th,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="fGARCH",submodel="AVGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(0,1))); fit=ugarchfit(spec=spec,data=diff(robusta$X5th,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p,q+1,n) theaicc <- aicc(loglik,p,q+1,n) thebic <- bic(loglik,p,q+1,n) Matrix2.5th.2.av[teller,1]=p;Matrix2.5th.2.av[teller,2]=q; Matrix2.5th.2.av[teller,3]=loglik;Matrix2.5th.2.av[teller,4]=theaic; Matrix2.5th.2.av[teller,5]=theaicc;Matrix2.5th.2.av[teller,6]=thebic; } } pmaxi=8;qmaxi=8 Matrix2.3rd.2.na=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in 1:(pmaxi+1)){ p=p-1; for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X3rd,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="fGARCH",submodel="NAGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(17,3))); fit=ugarchfit(spec=spec,data=diff(robusta$X3rd,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p+17,q+3,n) theaicc <- aicc(loglik,p+17,q+3,n) thebic <- bic(loglik,p+17,q+3,n) Matrix2.3rd.2.na[teller,1]=p;Matrix2.3rd.2.na[teller,2]=q; Matrix2.3rd.2.na[teller,3]=loglik;Matrix2.3rd.2.na[teller,4]=theaic; Matrix2.3rd.2.na[teller,5]=theaicc;Matrix2.3rd.2.na[teller,6]=thebic; } } Hulpna.3<-c(18,46,54,60,63,67,69,70) for (i in 1:length(Hulpna.3)){ Matrix2.3rd.2.na[Hulpna.3[i],3]=-Inf;Matrix2.3rd.2.na[Hulpna.3[i],4]=Inf; Matrix2.3rd.2.na[Hulpna.3[i],5]=Inf;Matrix2.3rd.2.na[Hulpna.3[i],6]=Inf; } pmaxi=8;qmaxi=8 Matrix2.4th.2.na=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in 1:(pmaxi+1)){ p=p-1; for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X4th,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="fGARCH",submodel="NAGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(0,1))); fit=ugarchfit(spec=spec,data=diff(robusta$X4th,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p,q+1,n) theaicc <- aicc(loglik,p,q+1,n) thebic <- bic(loglik,p,q+1,n) Matrix2.4th.2.na[teller,1]=p;Matrix2.4th.2.na[teller,2]=q; Matrix2.4th.2.na[teller,3]=loglik;Matrix2.4th.2.na[teller,4]=theaic; Matrix2.4th.2.na[teller,5]=theaicc;Matrix2.4th.2.na[teller,6]=thebic; } } Hulpna.4 <- c(33,50) for (i in 1:2){ Matrix2.4th.2.na[Hulpna.4[i],3]=-Inf;Matrix2.4th.2.na[Hulpna.4[i],4]=Inf; Matrix2.4th.2.na[Hulpna.4[i],5]=Inf;Matrix2.4th.2.na[Hulpna.4[i],6]=Inf; } pmaxi=8;qmaxi=8 Matrix2.5th.2.na=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in 1:(pmaxi+1)){ p=p-1; for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X5th,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="fGARCH",submodel="NAGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(0,1))); fit=ugarchfit(spec=spec,data=diff(robusta$X5th,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p,q+1,n) theaicc <- aicc(loglik,p,q+1,n) thebic <- bic(loglik,p,q+1,n) Matrix2.5th.2.na[teller,1]=p;Matrix2.5th.2.na[teller,2]=q; Matrix2.5th.2.na[teller,3]=loglik;Matrix2.5th.2.na[teller,4]=theaic; Matrix2.5th.2.na[teller,5]=theaicc;Matrix2.5th.2.na[teller,6]=thebic; } } pmaxi=8;qmaxi=8 Matrix2.3rd.2.n=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in 1:(pmaxi+1)){ p=p-1; for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X3rd,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="fGARCH",submodel="NGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(17,3))); fit=ugarchfit(spec=spec,data=diff(robusta$X3rd,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p+17,q+3,n) theaicc <- aicc(loglik,p+17,q+3,n) thebic <- bic(loglik,p+17,q+3,n) Matrix2.3rd.2.n[teller,1]=p;Matrix2.3rd.2.n[teller,2]=q; Matrix2.3rd.2.n[teller,3]=loglik;Matrix2.3rd.2.n[teller,4]=theaic; Matrix2.3rd.2.n[teller,5]=theaicc;Matrix2.3rd.2.n[teller,6]=thebic; } } for (i in 72){ Matrix2.3rd.2.n[i,1]=8;Matrix2.3rd.2.n[i,2]=i-64; Matrix2.3rd.2.n[i,3]=-Inf;Matrix2.3rd.2.n[i,4]=Inf; Matrix2.3rd.2.n[i,5]=Inf;Matrix2.3rd.2.n[i,6]=Inf; } pmaxi=8;qmaxi=8 Matrix2.4th.2.n=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in 1:(pmaxi+1)){ p=p-1; for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X4th,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="fGARCH",submodel="NGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(0,1))); fit=ugarchfit(spec=spec,data=diff(robusta$X4th,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p,q+1,n) theaicc <- aicc(loglik,p,q+1,n) thebic <- bic(loglik,p,q+1,n) Matrix2.4th.2.n[teller,1]=p;Matrix2.4th.2.n[teller,2]=q; Matrix2.4th.2.n[teller,3]=loglik;Matrix2.4th.2.n[teller,4]=theaic; Matrix2.4th.2.n[teller,5]=theaicc;Matrix2.4th.2.n[teller,6]=thebic; } } pmaxi=8;qmaxi=8 Matrix2.5th.2.n=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in 1:(pmaxi+1)){ p=p-1; for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X5th,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="fGARCH",submodel="NGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(0,1))); fit=ugarchfit(spec=spec,data=diff(robusta$X5th,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p,q+1,n) theaicc <- aicc(loglik,p,q+1,n) thebic <- bic(loglik,p,q+1,n) Matrix2.5th.2.n[teller,1]=p;Matrix2.5th.2.n[teller,2]=q; Matrix2.5th.2.n[teller,3]=loglik;Matrix2.5th.2.n[teller,4]=theaic; Matrix2.5th.2.n[teller,5]=theaicc;Matrix2.5th.2.n[teller,6]=thebic; } } for (i in 70:72){ Matrix2.5th.2.n[i,1]=8;Matrix2.5th.2.n[i,2]=i-64; Matrix2.5th.2.n[i,3]=-Inf;Matrix2.5th.2.n[i,4]=Inf; Matrix2.5th.2.n[i,5]=Inf;Matrix2.5th.2.n[i,6]=Inf; } pmaxi=8;qmaxi=8 Matrix2.3rd.2.gjr=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in 1:(pmaxi+1)){ p=p-1; for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X3rd,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="fGARCH",submodel="GJRGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(17,3))); fit=ugarchfit(spec=spec,data=diff(robusta$X3rd,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p+17,q+3,n) theaicc <- aicc(loglik,p+17,q+3,n) thebic <- bic(loglik,p+17,q+3,n) Matrix2.3rd.2.gjr[teller,1]=p;Matrix2.3rd.2.gjr[teller,2]=q; Matrix2.3rd.2.gjr[teller,3]=loglik;Matrix2.3rd.2.gjr[teller,4]=theaic; Matrix2.3rd.2.gjr[teller,5]=theaicc;Matrix2.3rd.2.gjr[teller,6]=thebic; } } for (i in 65:72){ Matrix2.3rd.2.gjr[i,1]=8;Matrix2.3rd.2.gjr[i,2]=i-64; Matrix2.3rd.2.gjr[i,3]=-Inf;Matrix2.3rd.2.gjr[i,4]=Inf; Matrix2.3rd.2.gjr[i,5]=Inf;Matrix2.3rd.2.gjr[i,6]=Inf; } pmaxi=8;qmaxi=8 Matrix2.4th.2.gjr=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in 1:(pmaxi+1)){ p=p-1; for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X4th,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="fGARCH",submodel="GJRGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(0,1))); fit=ugarchfit(spec=spec,data=diff(robusta$X4th,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p,q+1,n) theaicc <- aicc(loglik,p,q+1,n) thebic <- bic(loglik,p,q+1,n) Matrix2.4th.2.gjr[teller,1]=p;Matrix2.4th.2.gjr[teller,2]=q; Matrix2.4th.2.gjr[teller,3]=loglik;Matrix2.4th.2.gjr[teller,4]=theaic; Matrix2.4th.2.gjr[teller,5]=theaicc;Matrix2.4th.2.gjr[teller,6]=thebic; } } for (i in 65:72){ Matrix2.4th.2.gjr[i,1]=8;Matrix2.4th.2.gjr[i,2]=i-64; Matrix2.4th.2.gjr[i,3]=-Inf;Matrix2.4th.2.gjr[i,4]=Inf; Matrix2.4th.2.gjr[i,5]=Inf;Matrix2.4th.2.gjr[i,6]=Inf; } pmaxi=8;qmaxi=8 Matrix2.5th.2.gjr=matrix(NA,nrow=(pmaxi+1)*qmaxi,ncol=6) for (p in 1:(pmaxi+1)){ p=p-1; for (q in 2:(qmaxi+1)){ q=q-1; n=length(diff(robusta$X5th,lag=1)); teller=q+p*qmaxi spec=ugarchspec(variance.model=list(model="fGARCH",submodel="GJRGARCH",garchOrder=c(p,q)), mean.model=list(armaOrder=c(0,1))); fit=ugarchfit(spec=spec,data=diff(robusta$X5th,lag=1)); loglik <- fit@fit$LLH; theaic <- aic(loglik,p,q+1,n) theaicc <- aicc(loglik,p,q+1,n) thebic <- bic(loglik,p,q+1,n) Matrix2.5th.2.gjr[teller,1]=p;Matrix2.5th.2.gjr[teller,2]=q; Matrix2.5th.2.gjr[teller,3]=loglik;Matrix2.5th.2.gjr[teller,4]=theaic; Matrix2.5th.2.gjr[teller,5]=theaicc;Matrix2.5th.2.gjr[teller,6]=thebic; } } min(Matrix2.3rd.1.s[,4]);min(Matrix2.3rd.1.s[,5]);min(Matrix2.3rd.1.s[,6]); [1] 12348.5 [1] 12349.72 [1] 12467.26 min(Matrix2.4th.1.s[,4]);min(Matrix2.4th.1.s[,5]);min(Matrix2.4th.1.s[,6]); [1] 12214.79 [1] 12214.86 [1] 12235.5 min(Matrix2.5th.1.s[,4]);min(Matrix2.5th.1.s[,5]);min(Matrix2.5th.1.s[,6]); [1] 12160.37 [1] 12160.41 [1] 12180.96 min(Matrix2.3rd.1.i[,4]);min(Matrix2.3rd.1.i[,5]);min(Matrix2.3rd.1.i[,6]); [1] 12333.2 [1] 12334.16 [1] 12456.68 min(Matrix2.4th.1.i[,4]);min(Matrix2.4th.1.i[,5]);min(Matrix2.4th.1.i[,6]); [1] 12217.28 [1] 12217.53 [1] 12241.02 min(Matrix2.5th.1.i[,4]);min(Matrix2.5th.1.i[,5]);min(Matrix2.5th.1.i[,6]); [1] 12136.23 [1] 12136.72 [1] 12186.49 min(Matrix2.3rd.1.ap[,4]);min(Matrix2.3rd.1.ap[,5]);min(Matrix2.3rd.1.ap[,6]); [1] 12489.27 [1] 12490.09 [1] 12602.47 min(Matrix2.4th.1.ap[,4]);min(Matrix2.4th.1.ap[,5]);min(Matrix2.4th.1.ap[,6]); [1] 12387.58 [1] 12387.6 [1] 12403.01 min(Matrix2.5th.1.ap[,4]);min(Matrix2.5th.1.ap[,5]);min(Matrix2.5th.1.ap[,6]); [1] 12345.94 [1] 12345.96 [1] 12361.38 min(Matrix2.3rd.2.t[,4]);min(Matrix2.3rd.2.t[,5]);min(Matrix2.3rd.2.t[,6]); [1] 12350.61 [1] 12351.49 [1] 12468.95 min(Matrix2.4th.2.t[,4]);min(Matrix2.4th.2.t[,5]);min(Matrix2.4th.2.t[,6]); [1] 12214.72 [1] 12214.75 [1] 12235.3 min(Matrix2.5th.2.t[,4]);min(Matrix2.5th.2.t[,5]);min(Matrix2.5th.2.t[,6]); [1] 12157.64 [1] 12157.67 [1] 12178.22 min(Matrix2.3rd.2.av[,4]);min(Matrix2.3rd.2.av[,5]);min(Matrix2.3rd.2.av[,6]); [1] 12316.61 [1] 12318.54 [1] 12458.3 min(Matrix2.4th.2.av[,4]);min(Matrix2.4th.2.av[,5]);min(Matrix2.4th.2.av[,6]); [1] 12195.94 [1] 12196.23 [1] 12229.04 min(Matrix2.5th.2.av[,4]);min(Matrix2.5th.2.av[,5]);min(Matrix2.5th.2.av[,6]); [1] 12145.41 [1] 12145.74 [1] 12173.14 min(Matrix2.3rd.2.na[,4]);min(Matrix2.3rd.2.na[,5]);min(Matrix2.3rd.2.na[,6]); [1] 12326.71 [1] 12328.76 [1] 12463.74 min(Matrix2.4th.2.na[,4]);min(Matrix2.4th.2.na[,5]);min(Matrix2.4th.2.na[,6]); [1] 12200.31 [1] 12200.48 [1] 12228.8 min(Matrix2.5th.2.na[,4]);min(Matrix2.5th.2.na[,5]);min(Matrix2.5th.2.na[,6]); [1] 12146.72 [1] 12146.86 [1] 12173.78 min(Matrix2.3rd.2.n[,4]);min(Matrix2.3rd.2.n[,5]);min(Matrix2.3rd.2.n[,6]); [1] 12353.6 [1] 12354.49 [1] 12471.94 min(Matrix2.4th.2.n[,4]);min(Matrix2.4th.2.n[,5]);min(Matrix2.4th.2.n[,6]); [1] 12214.67 [1] 12214.7 [1] 12235.25 min(Matrix2.5th.2.n[,4]);min(Matrix2.5th.2.n[,5]);min(Matrix2.5th.2.n[,6]); [1] 12159.35 [1] 12159.38 [1] 12179.93 min(Matrix2.3rd.2.gjr[,4]);min(Matrix2.3rd.2.gjr[,5]);min(Matrix2.3rd.2.gjr[,6]); [1] 12350.86 [1] 12352.46 [1] 12474.41 min(Matrix2.4th.2.gjr[,4]);min(Matrix2.4th.2.gjr[,5]);min(Matrix2.4th.2.gjr[,6]); [1] 12212.09 [1] 12212.12 [1] 12232.67 min(Matrix2.5th.2.gjr[,4]);min(Matrix2.5th.2.gjr[,5]);min(Matrix2.5th.2.gjr[,6]); [1] 12157.79 [1] 12157.82 [1] 12178.37