R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- c(87.28 + ,87.28 + ,87.09 + ,86.92 + ,87.59 + ,90.72 + ,90.69 + ,90.3 + ,89.55 + ,88.94 + ,88.41 + ,87.82 + ,87.07 + ,86.82 + ,86.4 + ,86.02 + ,85.66 + ,85.32 + ,85 + ,84.67 + ,83.94 + ,82.83 + ,81.95 + ,81.19 + ,80.48 + ,78.86 + ,69.47 + ,68.77 + ,70.06 + ,73.95 + ,75.8 + ,77.79 + ,81.57 + ,83.07 + ,84.34 + ,85.1 + ,85.25 + ,84.26 + ,83.63 + ,86.44 + ,85.3 + ,84.1 + ,83.36 + ,82.48 + ,81.58 + ,80.47 + ,79.34 + ,82.13 + ,81.69 + ,80.7 + ,79.88 + ,79.16 + ,78.38 + ,77.42 + ,76.47 + ,75.46 + ,74.48 + ,78.27 + ,80.7 + ,79.91 + ,78.75 + ,77.78 + ,81.14 + ,81.08 + ,80.03 + ,78.91 + ,78.01 + ,76.9 + ,75.97 + ,81.93 + ,80.27 + ,78.67 + ,77.42 + ,76.16 + ,74.7 + ,76.39 + ,76.04 + ,74.65 + ,73.29 + ,71.79 + ,74.39 + ,74.91 + ,74.54 + ,73.08 + ,72.75 + ,71.32 + ,70.38 + ,70.35 + ,70.01 + ,69.36 + ,67.77 + ,69.26 + ,69.8 + ,68.38 + ,67.62 + ,68.39 + ,66.95 + ,65.21 + ,66.64 + ,63.45 + ,60.66 + ,62.34 + ,60.32 + ,58.64 + ,60.46 + ,58.59 + ,61.87 + ,61.85 + ,67.44 + ,77.06 + ,91.74 + ,93.15 + ,94.15 + ,93.11 + ,91.51 + ,89.96 + ,88.16 + ,86.98 + ,88.03 + ,86.24 + ,84.65 + ,83.23 + ,81.7 + ,80.25 + ,78.8 + ,77.51 + ,76.2 + ,75.04 + ,74 + ,75.49 + ,77.14 + ,76.15 + ,76.27 + ,78.19 + ,76.49 + ,77.31 + ,76.65 + ,74.99 + ,73.51 + ,72.07 + ,70.59 + ,71.96 + ,76.29 + ,74.86 + ,74.93 + ,71.9 + ,71.01 + ,77.47 + ,75.78 + ,76.6 + ,76.07 + ,74.57 + ,73.02 + ,72.65 + ,73.16 + ,71.53 + ,69.78 + ,67.98 + ,69.96 + ,72.16 + ,70.47 + ,68.86 + ,67.37 + ,65.87 + ,72.16 + ,71.34 + ,69.93 + ,68.44 + ,67.16 + ,66.01 + ,67.25 + ,70.91 + ,69.75 + ,68.59 + ,67.48 + ,66.31 + ,64.81 + ,66.58 + ,65.97 + ,64.7 + ,64.7 + ,60.94 + ,59.08 + ,58.42 + ,57.77 + ,57.11 + ,53.31 + ,49.96 + ,49.4 + ,48.84 + ,48.3 + ,47.74 + ,47.24 + ,46.76 + ,46.29 + ,48.9 + ,49.23 + ,48.53 + ,48.03 + ,54.34 + ,53.79 + ,53.24 + ,52.96 + ,52.17 + ,51.7 + ,58.55 + ,78.2 + ,77.03 + ,76.19 + ,77.15 + ,75.87 + ,95.47 + ,109.67 + ,112.28 + ,112.01 + ,107.93 + ,105.96 + ,105.06 + ,102.98 + ,102.2 + ,105.23 + ,101.85 + ,99.89 + ,96.23 + ,94.76 + ,91.51 + ,91.63 + ,91.54 + ,85.23 + ,87.83 + ,87.38 + ,84.44 + ,85.19 + ,84.03 + ,86.73 + ,102.52 + ,104.45 + ,106.98 + ,107.02 + ,99.26 + ,94.45 + ,113.44 + ,157.33 + ,147.38 + ,171.89 + ,171.95 + ,132.71 + ,126.02 + ,121.18 + ,115.45 + ,110.48 + ,117.85 + ,117.63 + ,124.65 + ,109.59 + ,111.27 + ,99.78 + ,98.21 + ,99.2 + ,97.97 + ,89.55 + ,87.91 + ,93.34 + ,94.42 + ,93.2 + ,90.29 + ,91.46 + ,89.98 + ,88.35 + ,88.41 + ,82.44 + ,79.89 + ,75.69 + ,75.66 + ,84.5 + ,96.73 + ,87.48 + ,82.39 + ,83.48 + ,79.31 + ,78.16 + ,72.77 + ,72.45 + ,68.46 + ,67.62 + ,68.76 + ,70.07 + ,68.55 + ,65.3 + ,58.96 + ,59.17 + ,62.37 + ,66.28 + ,55.62 + ,55.23 + ,55.85 + ,56.75 + ,50.89 + ,53.88 + ,52.95 + ,55.08 + ,53.61 + ,58.78 + ,61.85 + ,55.91 + ,53.32 + ,46.41 + ,44.57 + ,50 + ,50 + ,53.36 + ,46.23 + ,50.45 + ,49.07 + ,45.85 + ,48.45 + ,49.96 + ,46.53 + ,50.51 + ,47.58 + ,48.05 + ,46.84 + ,47.67 + ,49.16 + ,55.54 + ,55.82 + ,58.22 + ,56.19 + ,57.77 + ,63.19 + ,54.76 + ,55.74 + ,62.54 + ,61.39 + ,69.6 + ,79.23 + ,80 + ,93.68 + ,107.63 + ,100.18 + ,97.3 + ,90.45 + ,80.64 + ,80.58 + ,75.82 + ,85.59 + ,89.35 + ,89.42 + ,104.73 + ,95.32 + ,89.27 + ,90.44 + ,86.97 + ,79.98 + ,81.22 + ,87.35 + ,83.64 + ,82.22) > par9 = '1' > par8 = '2' > par7 = '1' > par6 = '3' > par5 = '12' > par4 = '0' > par3 = '1' > par2 = '1' > par1 = 'FALSE' > library(lattice) > if (par1 == 'TRUE') par1 <- TRUE > if (par1 == 'FALSE') par1 <- FALSE > par2 <- as.numeric(par2) #Box-Cox lambda transformation parameter > par3 <- as.numeric(par3) #degree of non-seasonal differencing > par4 <- as.numeric(par4) #degree of seasonal differencing > par5 <- as.numeric(par5) #seasonal period > par6 <- as.numeric(par6) #degree (p) of the non-seasonal AR(p) polynomial > par6 <- 11 > par7 <- as.numeric(par7) #degree (q) of the non-seasonal MA(q) polynomial > par8 <- as.numeric(par8) #degree (P) of the seasonal AR(P) polynomial > par9 <- as.numeric(par9) #degree (Q) of the seasonal MA(Q) polynomial > armaGR <- function(arima.out, names, n){ + try1 <- arima.out$coef + try2 <- sqrt(diag(arima.out$var.coef)) + try.data.frame <- data.frame(matrix(NA,ncol=4,nrow=length(names))) + dimnames(try.data.frame) <- list(names,c('coef','std','tstat','pv')) + try.data.frame[,1] <- try1 + for(i in 1:length(try2)) try.data.frame[which(rownames(try.data.frame)==names(try2)[i]),2] <- try2[i] + try.data.frame[,3] <- try.data.frame[,1] / try.data.frame[,2] + try.data.frame[,4] <- round((1-pt(abs(try.data.frame[,3]),df=n-(length(try2)+1)))*2,5) + vector <- rep(NA,length(names)) + vector[is.na(try.data.frame[,4])] <- 0 + maxi <- which.max(try.data.frame[,4]) + continue <- max(try.data.frame[,4],na.rm=TRUE) > .05 + vector[maxi] <- 0 + list(summary=try.data.frame,next.vector=vector,continue=continue) + } > arimaSelect <- function(series, order=c(13,0,0), seasonal=list(order=c(2,0,0),period=12), include.mean=F){ + nrc <- order[1]+order[3]+seasonal$order[1]+seasonal$order[3] + coeff <- matrix(NA, nrow=nrc*2, ncol=nrc) + pval <- matrix(NA, nrow=nrc*2, ncol=nrc) + mylist <- rep(list(NULL), nrc) + names <- NULL + if(order[1] > 0) names <- paste('ar',1:order[1],sep='') + if(order[3] > 0) names <- c( names , paste('ma',1:order[3],sep='') ) + if(seasonal$order[1] > 0) names <- c(names, paste('sar',1:seasonal$order[1],sep='')) + if(seasonal$order[3] > 0) names <- c(names, paste('sma',1:seasonal$order[3],sep='')) + arima.out <- arima(series, order=order, seasonal=seasonal, include.mean=include.mean, method='ML') + mylist[[1]] <- arima.out + last.arma <- armaGR(arima.out, names, length(series)) + mystop <- FALSE + i <- 1 + coeff[i,] <- last.arma[[1]][,1] + pval [i,] <- last.arma[[1]][,4] + i <- 2 + aic <- arima.out$aic + while(!mystop){ + mylist[[i]] <- arima.out + arima.out <- arima(series, order=order, seasonal=seasonal, include.mean=include.mean, method='ML', fixed=last.arma$next.vector) + aic <- c(aic, arima.out$aic) + last.arma <- armaGR(arima.out, names, length(series)) + mystop <- !last.arma$continue + coeff[i,] <- last.arma[[1]][,1] + pval [i,] <- last.arma[[1]][,4] + i <- i+1 + } + list(coeff, pval, mylist, aic=aic) + } > arimaSelectplot <- function(arimaSelect.out,noms,choix){ + noms <- names(arimaSelect.out[[3]][[1]]$coef) + coeff <- arimaSelect.out[[1]] + k <- min(which(is.na(coeff[,1])))-1 + coeff <- coeff[1:k,] + pval <- arimaSelect.out[[2]][1:k,] + aic <- arimaSelect.out$aic[1:k] + coeff[coeff==0] <- NA + n <- ncol(coeff) + if(missing(choix)) choix <- k + layout(matrix(c(1,1,1,2, + 3,3,3,2, + 3,3,3,4, + 5,6,7,7),nr=4), + widths=c(10,35,45,15), + heights=c(30,30,15,15)) + couleurs <- rainbow(75)[1:50]#(50) + ticks <- pretty(coeff) + par(mar=c(1,1,3,1)) + plot(aic,k:1-.5,type='o',pch=21,bg='blue',cex=2,axes=F,lty=2,xpd=NA) + points(aic[choix],k-choix+.5,pch=21,cex=4,bg=2,xpd=NA) + title('aic',line=2) + par(mar=c(3,0,0,0)) + plot(0,axes=F,xlab='',ylab='',xlim=range(ticks),ylim=c(.1,1)) + rect(xleft = min(ticks) + (0:49)/50*(max(ticks)-min(ticks)), + xright = min(ticks) + (1:50)/50*(max(ticks)-min(ticks)), + ytop = rep(1,50), + ybottom= rep(0,50),col=couleurs,border=NA) + axis(1,ticks) + rect(xleft=min(ticks),xright=max(ticks),ytop=1,ybottom=0) + text(mean(coeff,na.rm=T),.5,'coefficients',cex=2,font=2) + par(mar=c(1,1,3,1)) + image(1:n,1:k,t(coeff[k:1,]),axes=F,col=couleurs,zlim=range(ticks)) + for(i in 1:n) for(j in 1:k) if(!is.na(coeff[j,i])) { + if(pval[j,i]<.01) symb = 'green' + else if( (pval[j,i]<.05) & (pval[j,i]>=.01)) symb = 'orange' + else if( (pval[j,i]<.1) & (pval[j,i]>=.05)) symb = 'red' + else symb = 'black' + polygon(c(i+.5 ,i+.2 ,i+.5 ,i+.5), + c(k-j+0.5,k-j+0.5,k-j+0.8,k-j+0.5), + col=symb) + if(j==choix) { + rect(xleft=i-.5, + xright=i+.5, + ybottom=k-j+1.5, + ytop=k-j+.5, + lwd=4) + text(i, + k-j+1, + round(coeff[j,i],2), + cex=1.2, + font=2) + } + else{ + rect(xleft=i-.5,xright=i+.5,ybottom=k-j+1.5,ytop=k-j+.5) + text(i,k-j+1,round(coeff[j,i],2),cex=1.2,font=1) + } + } + axis(3,1:n,noms) + par(mar=c(0.5,0,0,0.5)) + plot(0,axes=F,xlab='',ylab='',type='n',xlim=c(0,8),ylim=c(-.2,.8)) + cols <- c('green','orange','red','black') + niv <- c('0','0.01','0.05','0.1') + for(i in 0:3){ + polygon(c(1+2*i ,1+2*i ,1+2*i-.5 ,1+2*i), + c(.4 ,.7 , .4 , .4), + col=cols[i+1]) + text(2*i,0.5,niv[i+1],cex=1.5) + } + text(8,.5,1,cex=1.5) + text(4,0,'p-value',cex=2) + box() + residus <- arimaSelect.out[[3]][[choix]]$res + par(mar=c(1,2,4,1)) + acf(residus,main='') + title('acf',line=.5) + par(mar=c(1,2,4,1)) + pacf(residus,main='') + title('pacf',line=.5) + par(mar=c(2,2,4,1)) + qqnorm(residus,main='') + title('qq-norm',line=.5) + qqline(residus) + residus + } > if (par2 == 0) x <- log(x) > if (par2 != 0) x <- x^par2 > (selection <- arimaSelect(x, order=c(par6,par3,par7), seasonal=list(order=c(par8,par4,par9), period=par5))) [[1]] [,1] [,2] [,3] [,4] [,5] [,6] [1,] -0.3486213 0.06295785 0.1160161 -0.2084927 -0.2235806 0.03484587 [2,] -0.3438912 0.06239623 0.1159069 -0.2091441 -0.2223532 0.03543091 [3,] -0.3469362 0.06271936 0.1173888 -0.2098563 -0.2236774 0.03595376 [4,] -0.3653655 0.06563064 0.1198434 -0.2078905 -0.2334465 0.02837153 [5,] -0.4212906 0.06635345 0.1188457 -0.2009058 -0.2534794 0.00000000 [6,] -0.4461179 0.07206790 0.1197006 -0.2003914 -0.2623651 0.00000000 [7,] -0.4545862 0.07438061 0.1185677 -0.2024028 -0.2697009 0.00000000 [8,] -0.3724334 0.05696984 0.1146696 -0.2014615 -0.2357930 0.00000000 [9,] -0.2987159 0.00000000 0.1052658 -0.2083057 -0.2124558 0.00000000 [10,] 0.0000000 0.00000000 0.1261304 -0.2382715 -0.1391190 0.00000000 [11,] 0.0000000 0.00000000 0.1230532 -0.2310550 -0.1336719 0.00000000 [12,] NA NA NA NA NA NA [13,] NA NA NA NA NA NA [14,] NA NA NA NA NA NA [15,] NA NA NA NA NA NA [16,] NA NA NA NA NA NA [17,] NA NA NA NA NA NA [18,] NA NA NA NA NA NA [19,] NA NA NA NA NA NA [20,] NA NA NA NA NA NA [21,] NA NA NA NA NA NA [22,] NA NA NA NA NA NA [23,] NA NA NA NA NA NA [24,] NA NA NA NA NA NA [25,] NA NA NA NA NA NA [26,] NA NA NA NA NA NA [27,] NA NA NA NA NA NA [28,] NA NA NA NA NA NA [29,] NA NA NA NA NA NA [30,] NA NA NA NA NA NA [,7] [,8] [,9] [,10] [,11] [,12] [1,] 0.1526397 0.001087749 -0.04043517 0.02677285 0.11180233 0.4676284 [2,] 0.1520717 0.000000000 -0.04041641 0.02702212 0.11172058 0.4628116 [3,] 0.1541384 0.000000000 -0.04151932 0.02606277 0.11225670 0.4655841 [4,] 0.1566210 0.000000000 -0.05140222 0.00000000 0.10647210 0.4841625 [5,] 0.1484067 0.000000000 -0.05422272 0.00000000 0.10354351 0.5370275 [6,] 0.1571131 0.000000000 -0.05882291 0.00000000 0.11672410 0.5634831 [7,] 0.1609545 0.000000000 -0.05718702 0.00000000 0.11586504 0.5710380 [8,] 0.1479118 0.000000000 0.00000000 0.00000000 0.10807096 0.4866504 [9,] 0.1436375 0.000000000 0.00000000 0.00000000 0.10961958 0.3978367 [10,] 0.1410787 0.000000000 0.00000000 0.00000000 0.08766006 0.1155066 [11,] 0.1198237 0.000000000 0.00000000 0.00000000 0.00000000 0.1103325 [12,] NA NA NA NA NA NA [13,] NA NA NA NA NA NA [14,] NA NA NA NA NA NA [15,] NA NA NA NA NA NA [16,] NA NA NA NA NA NA [17,] NA NA NA NA NA NA [18,] NA NA NA NA NA NA [19,] NA NA NA NA NA NA [20,] NA NA NA NA NA NA [21,] NA NA NA NA NA NA [22,] NA NA NA NA NA NA [23,] NA NA NA NA NA NA [24,] NA NA NA NA NA NA [25,] NA NA NA NA NA NA [26,] NA NA NA NA NA NA [27,] NA NA NA NA NA NA [28,] NA NA NA NA NA NA [29,] NA NA NA NA NA NA [30,] NA NA NA NA NA NA [,13] [,14] [,15] [1,] 0.2142582 0.06080569 -0.25999537 [2,] 0.2136676 0.06094689 -0.26012628 [3,] 0.0000000 0.04751205 -0.04720217 [4,] 0.0000000 0.04424170 -0.04065230 [5,] 0.0000000 0.04624291 -0.03831723 [6,] 0.0000000 0.04332969 0.00000000 [7,] 0.0000000 0.00000000 0.00000000 [8,] 0.0000000 0.00000000 0.00000000 [9,] 0.0000000 0.00000000 0.00000000 [10,] 0.0000000 0.00000000 0.00000000 [11,] 0.0000000 0.00000000 0.00000000 [12,] NA NA NA [13,] NA NA NA [14,] NA NA NA [15,] NA NA NA [16,] NA NA NA [17,] NA NA NA [18,] NA NA NA [19,] NA NA NA [20,] NA NA NA [21,] NA NA NA [22,] NA NA NA [23,] NA NA NA [24,] NA NA NA [25,] NA NA NA [26,] NA NA NA [27,] NA NA NA [28,] NA NA NA [29,] NA NA NA [30,] NA NA NA [[2]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 0.45883 0.42750 0.04137 0.00906 0.09774 0.65827 0.03989 0.99004 0.49223 [2,] 0.29004 0.36668 0.03542 0.00067 0.02618 0.58649 0.01012 NA 0.49296 [3,] 0.27556 0.36086 0.03291 0.00063 0.02362 0.57943 0.00883 NA 0.48022 [4,] 0.21029 0.32866 0.02960 0.00059 0.01200 0.64784 0.00672 NA 0.36615 [5,] 0.06794 0.30724 0.03405 0.00064 0.00121 NA 0.00523 NA 0.32645 [6,] 0.02283 0.24742 0.03378 0.00061 0.00023 NA 0.00191 NA 0.26746 [7,] 0.01736 0.23116 0.03574 0.00051 0.00012 NA 0.00140 NA 0.27958 [8,] 0.06224 0.34056 0.03757 0.00049 0.00045 NA 0.00322 NA NA [9,] 0.17901 NA 0.05894 0.00030 0.00214 NA 0.00506 NA NA [10,] NA NA 0.01497 0.00000 0.00600 NA 0.00844 NA NA [11,] NA NA 0.01795 0.00001 0.00836 NA 0.02158 NA NA [12,] NA NA NA NA NA NA NA NA NA [13,] NA NA NA NA NA NA NA NA NA [14,] NA NA NA NA NA NA NA NA NA [15,] NA NA NA NA NA NA NA NA NA [16,] NA NA NA NA NA NA NA NA NA [17,] NA NA NA NA NA NA NA NA NA [18,] NA NA NA NA NA NA NA NA NA [19,] NA NA NA NA NA NA NA NA NA [20,] NA NA NA NA NA NA NA NA NA [21,] NA NA NA NA NA NA NA NA NA [22,] NA NA NA NA NA NA NA NA NA [23,] NA NA NA NA NA NA NA NA NA [24,] NA NA NA NA NA NA NA NA NA [25,] NA NA NA NA NA NA NA NA NA [26,] NA NA NA NA NA NA NA NA NA [27,] NA NA NA NA NA NA NA NA NA [28,] NA NA NA NA NA NA NA NA NA [29,] NA NA NA NA NA NA NA NA NA [30,] NA NA NA NA NA NA NA NA NA [,10] [,11] [,12] [,13] [,14] [,15] [1,] 0.66029 0.04587 0.32122 0.69245 0.31800 0.62930 [2,] 0.63867 0.04467 0.15915 0.69056 0.31227 0.62858 [3,] 0.65053 0.04324 0.14795 NA 0.39850 0.44199 [4,] NA 0.04680 0.10045 NA 0.42752 0.49635 [5,] NA 0.05077 0.02218 NA 0.40549 0.51670 [6,] NA 0.01589 0.00464 NA 0.43319 NA [7,] NA 0.01671 0.00326 NA NA NA [8,] NA 0.02859 0.01708 NA NA NA [9,] NA 0.03062 0.06154 NA NA NA [10,] NA 0.09628 0.02516 NA NA NA [11,] NA NA 0.03258 NA NA NA [12,] NA NA NA NA NA NA [13,] NA NA NA NA NA NA [14,] NA NA NA NA NA NA [15,] NA NA NA NA NA NA [16,] NA NA NA NA NA NA [17,] NA NA NA NA NA NA [18,] NA NA NA NA NA NA [19,] NA NA NA NA NA NA [20,] NA NA NA NA NA NA [21,] NA NA NA NA NA NA [22,] NA NA NA NA NA NA [23,] NA NA NA NA NA NA [24,] NA NA NA NA NA NA [25,] NA NA NA NA NA NA [26,] NA NA NA NA NA NA [27,] NA NA NA NA NA NA [28,] NA NA NA NA NA NA [29,] NA NA NA NA NA NA [30,] NA NA NA NA NA NA [[3]] [[3]][[1]] Call: arima(x = series, order = order, seasonal = seasonal, include.mean = include.mean, method = "ML") Coefficients: ar1 ar2 ar3 ar4 ar5 ar6 ar7 ar8 -0.3486 0.0630 0.1160 -0.2085 -0.2236 0.0348 0.1526 0.0011 s.e. 0.4701 0.0792 0.0567 0.0794 0.1347 0.0787 0.0740 0.0871 ar9 ar10 ar11 ma1 sar1 sar2 sma1 -0.0404 0.0268 0.1118 0.4676 0.2143 0.0608 -0.2600 s.e. 0.0588 0.0609 0.0558 0.4707 0.5412 0.0608 0.5381 sigma^2 estimated as 25.41: log likelihood = -1084.36, aic = 2200.72 [[3]][[2]] Call: arima(x = series, order = order, seasonal = seasonal, include.mean = include.mean, method = "ML") Coefficients: ar1 ar2 ar3 ar4 ar5 ar6 ar7 ar8 -0.3486 0.0630 0.1160 -0.2085 -0.2236 0.0348 0.1526 0.0011 s.e. 0.4701 0.0792 0.0567 0.0794 0.1347 0.0787 0.0740 0.0871 ar9 ar10 ar11 ma1 sar1 sar2 sma1 -0.0404 0.0268 0.1118 0.4676 0.2143 0.0608 -0.2600 s.e. 0.0588 0.0609 0.0558 0.4707 0.5412 0.0608 0.5381 sigma^2 estimated as 25.41: log likelihood = -1084.36, aic = 2200.72 [[3]][[3]] Call: arima(x = series, order = order, seasonal = seasonal, include.mean = include.mean, fixed = last.arma$next.vector, method = "ML") Coefficients: ar1 ar2 ar3 ar4 ar5 ar6 ar7 ar8 ar9 -0.3439 0.0624 0.1159 -0.2091 -0.2224 0.0354 0.1521 0 -0.0404 s.e. 0.3245 0.0690 0.0549 0.0609 0.0996 0.0651 0.0588 0 0.0589 ar10 ar11 ma1 sar1 sar2 sma1 0.0270 0.1117 0.4628 0.2137 0.0609 -0.2601 s.e. 0.0575 0.0554 0.3280 0.5363 0.0602 0.5373 sigma^2 estimated as 25.41: log likelihood = -1084.36, aic = 2198.72 [[3]][[4]] Call: arima(x = series, order = order, seasonal = seasonal, include.mean = include.mean, fixed = last.arma$next.vector, method = "ML") Coefficients: ar1 ar2 ar3 ar4 ar5 ar6 ar7 ar8 ar9 -0.3469 0.0627 0.1174 -0.2099 -0.2237 0.0360 0.1541 0 -0.0415 s.e. 0.3177 0.0686 0.0548 0.0608 0.0984 0.0648 0.0585 0 0.0587 ar10 ar11 ma1 sar1 sar2 sma1 0.0261 0.1123 0.4656 0 0.0475 -0.0472 s.e. 0.0575 0.0553 0.3211 0 0.0562 0.0613 sigma^2 estimated as 25.42: log likelihood = -1084.43, aic = 2196.87 [[3]][[5]] Call: arima(x = series, order = order, seasonal = seasonal, include.mean = include.mean, fixed = last.arma$next.vector, method = "ML") Coefficients: ar1 ar2 ar3 ar4 ar5 ar6 ar7 ar8 ar9 -0.3654 0.0656 0.1198 -0.2079 -0.2334 0.0284 0.1566 0 -0.0514 s.e. 0.2911 0.0671 0.0549 0.0600 0.0924 0.0621 0.0574 0 0.0568 ar10 ar11 ma1 sar1 sar2 sma1 0 0.1065 0.4842 0 0.0442 -0.0407 s.e. 0 0.0534 0.2939 0 0.0557 0.0597 sigma^2 estimated as 25.43: log likelihood = -1084.53, aic = 2195.07 [[3]][[6]] Call: arima(x = series, order = order, seasonal = seasonal, include.mean = include.mean, fixed = last.arma$next.vector, method = "ML") Coefficients: ar1 ar2 ar3 ar4 ar5 ar6 ar7 ar8 ar9 -0.4213 0.0664 0.1188 -0.2009 -0.2535 0 0.1484 0 -0.0542 s.e. 0.2301 0.0649 0.0559 0.0583 0.0777 0 0.0528 0 0.0552 ar10 ar11 ma1 sar1 sar2 sma1 0 0.1035 0.5370 0 0.0462 -0.0383 s.e. 0 0.0528 0.2337 0 0.0555 0.0590 sigma^2 estimated as 25.45: log likelihood = -1084.64, aic = 2193.27 [[3]][[7]] Call: arima(x = series, order = order, seasonal = seasonal, include.mean = include.mean, fixed = last.arma$next.vector, method = "ML") Coefficients: ar1 ar2 ar3 ar4 ar5 ar6 ar7 ar8 ar9 -0.4461 0.0721 0.1197 -0.2004 -0.2624 0 0.1571 0 -0.0588 s.e. 0.1951 0.0622 0.0562 0.0580 0.0706 0 0.0502 0 0.0530 ar10 ar11 ma1 sar1 sar2 sma1 0 0.1167 0.5635 0 0.0433 0 s.e. 0 0.0482 0.1977 0 0.0552 0 sigma^2 estimated as 25.48: log likelihood = -1084.85, aic = 2191.69 [[3]][[8]] Call: arima(x = series, order = order, seasonal = seasonal, include.mean = include.mean, fixed = last.arma$next.vector, method = "ML") Coefficients: ar1 ar2 ar3 ar4 ar5 ar6 ar7 ar8 ar9 ar10 -0.4546 0.0744 0.1186 -0.2024 -0.2697 0 0.161 0 -0.0572 0 s.e. 0.1902 0.0620 0.0562 0.0577 0.0693 0 0.050 0 0.0528 0 ar11 ma1 sar1 sar2 sma1 0.1159 0.5710 0 0 0 s.e. 0.0482 0.1928 0 0 0 sigma^2 estimated as 25.52: log likelihood = -1085.15, aic = 2190.31 [[3]][[9]] Call: arima(x = series, order = order, seasonal = seasonal, include.mean = include.mean, fixed = last.arma$next.vector, method = "ML") Coefficients: ar1 ar2 ar3 ar4 ar5 ar6 ar7 ar8 ar9 ar10 -0.3724 0.0570 0.1147 -0.2015 -0.2358 0 0.1479 0 0 0 s.e. 0.1991 0.0597 0.0549 0.0572 0.0666 0 0.0499 0 0 0 ar11 ma1 sar1 sar2 sma1 0.1081 0.4867 0 0 0 s.e. 0.0492 0.2031 0 0 0 sigma^2 estimated as 25.61: log likelihood = -1085.72, aic = 2189.45 [[3]][[10]] Call: arima(x = series, order = order, seasonal = seasonal, include.mean = include.mean, fixed = last.arma$next.vector, method = "ML") Coefficients: ar1 ar2 ar3 ar4 ar5 ar6 ar7 ar8 ar9 ar10 -0.2987 0 0.1053 -0.2083 -0.2125 0 0.1436 0 0 0 s.e. 0.2218 0 0.0556 0.0570 0.0687 0 0.0509 0 0 0 ar11 ma1 sar1 sar2 sma1 0.1096 0.3978 0 0 0 s.e. 0.0505 0.2121 0 0 0 sigma^2 estimated as 25.68: log likelihood = -1086.19, aic = 2188.38 [[3]][[11]] Call: arima(x = series, order = order, seasonal = seasonal, include.mean = include.mean, fixed = last.arma$next.vector, method = "ML") Coefficients: ar1 ar2 ar3 ar4 ar5 ar6 ar7 ar8 ar9 ar10 ar11 0 0 0.1261 -0.2383 -0.1391 0 0.1411 0 0 0 0.0877 s.e. 0 0 0.0516 0.0505 0.0503 0 0.0533 0 0 0 0.0526 ma1 sar1 sar2 sma1 0.1155 0 0 0 s.e. 0.0514 0 0 0 sigma^2 estimated as 25.80: log likelihood = -1087.05, aic = 2188.1 [[3]][[12]] NULL [[3]][[13]] NULL [[3]][[14]] NULL [[3]][[15]] NULL $aic [1] 2200.716 2198.716 2196.865 2195.069 2193.275 2191.693 2190.308 2189.448 [9] 2188.380 2188.100 2188.869 Warning messages: 1: In arima(series, order = order, seasonal = seasonal, include.mean = include.mean, : some AR parameters were fixed: setting transform.pars = FALSE 2: In arima(series, order = order, seasonal = seasonal, include.mean = include.mean, : some AR parameters were fixed: setting transform.pars = FALSE 3: In arima(series, order = order, seasonal = seasonal, include.mean = include.mean, : some AR parameters were fixed: setting transform.pars = FALSE 4: In arima(series, order = order, seasonal = seasonal, include.mean = include.mean, : some AR parameters were fixed: setting transform.pars = FALSE 5: In arima(series, order = order, seasonal = seasonal, include.mean = include.mean, : some AR parameters were fixed: setting transform.pars = FALSE 6: In arima(series, order = order, seasonal = seasonal, include.mean = include.mean, : some AR parameters were fixed: setting transform.pars = FALSE 7: In arima(series, order = order, seasonal = seasonal, include.mean = include.mean, : some AR parameters were fixed: setting transform.pars = FALSE 8: In arima(series, order = order, seasonal = seasonal, include.mean = include.mean, : some AR parameters were fixed: setting transform.pars = FALSE 9: In arima(series, order = order, seasonal = seasonal, include.mean = include.mean, : some AR parameters were fixed: setting transform.pars = FALSE 10: In arima(series, order = order, seasonal = seasonal, include.mean = include.mean, : some AR parameters were fixed: setting transform.pars = FALSE > postscript(file="/var/www/html/rcomp/tmp/1phkp1260394735.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > resid <- arimaSelectplot(selection) > dev.off() null device 1 > resid Time Series: Start = 1 End = 358 Frequency = 1 [1] 8.727995e-02 -1.107190e-05 -1.802795e-01 -1.392710e-01 6.517427e-01 [6] 2.993088e+00 -3.919883e-01 -4.251671e-01 -9.623508e-01 3.315313e-01 [11] -5.572910e-02 -6.274893e-01 -1.275329e+00 -2.646464e-01 -4.562383e-01 [16] -3.999401e-01 -7.313735e-01 -2.890524e-01 -2.561129e-01 -2.324294e-01 [21] -7.101692e-01 -1.012991e+00 -7.395878e-01 -5.891118e-01 -6.519147e-01 [26] -1.717781e+00 -9.379960e+00 3.040342e-01 1.370712e+00 4.583464e+00 [31] -9.177239e-01 6.243353e-01 3.753075e+00 3.341364e+00 1.780403e+00 [36] 6.893565e-01 6.519054e-01 2.199245e-01 -4.593631e-01 2.555548e+00 [41] -1.721458e+00 -1.478060e+00 -1.493203e+00 -3.343554e-01 -5.825506e-01 [46] -1.416345e+00 -1.661725e+00 2.930511e+00 -7.192799e-01 -9.944555e-01 [51] -1.602882e+00 2.551172e-01 -1.395067e-01 -9.132729e-01 -1.403276e+00 [56] -8.941950e-01 -8.046763e-01 3.880256e+00 1.606289e+00 -1.076135e+00 [61] -1.665531e+00 -1.114985e-01 4.784387e+00 -1.098606e-01 -1.751798e+00 [66] -1.993499e+00 2.034659e-01 -2.983631e-01 -1.208189e+00 5.113094e+00 [71] -2.403133e+00 -1.344991e+00 -1.979358e+00 3.011559e-01 -6.975014e-01 [76] 1.539303e+00 -1.631955e+00 -1.178384e+00 -1.637187e+00 -8.093111e-01 [81] 2.675823e+00 3.540635e-01 -8.372928e-01 -2.078883e+00 5.619155e-01 [86] -6.427754e-01 -6.339509e-01 -6.506255e-01 -3.177388e-01 -7.099573e-01 [91] -1.589662e+00 1.397221e+00 5.315699e-01 -1.317981e+00 -1.132762e+00 [96] 1.043451e+00 -8.284114e-01 -1.504960e+00 9.204996e-01 -3.083336e+00 [101] -2.193066e+00 1.384623e+00 -1.918160e+00 -1.511865e+00 1.044119e+00 [106] -1.858786e+00 3.841555e+00 -8.547588e-01 6.040045e+00 8.475881e+00 [111] 1.474153e+01 -5.584597e-01 1.296835e+00 -2.572044e-01 3.238106e+00 [116] -6.200947e-01 -2.356023e+00 -3.173299e+00 8.889532e-01 -2.888655e+00 [121] -2.448598e+00 -2.862306e+00 -7.925154e-01 -1.272061e+00 -1.494199e+00 [126] -1.491852e+00 -1.128493e+00 -1.023005e+00 -1.002574e+00 1.385749e+00 [131] 1.506124e+00 -1.147489e+00 -3.810322e-02 2.245560e+00 -9.433143e-01 [136] 1.181310e+00 -1.244880e+00 -9.455561e-01 -1.370808e+00 -1.165299e+00 [141] -1.580690e+00 1.347099e+00 3.743548e+00 -2.142146e+00 -3.424563e-01 [146] -3.058234e+00 9.971935e-01 6.864298e+00 -2.330720e+00 8.111322e-03 [151] -1.651358e+00 4.391826e-01 -9.007513e-01 -4.928446e-01 -4.209862e-02 [156] -1.628489e+00 -1.943304e+00 -1.790868e+00 2.107828e+00 2.226646e+00 [161] -2.383579e+00 -2.282256e+00 -9.210593e-01 1.962551e-03 6.682602e+00 [166] -2.346721e+00 -1.696236e+00 -2.260300e+00 7.594807e-01 -3.435650e-01 [171] 1.036344e+00 2.411320e+00 -1.548931e+00 -1.260040e+00 -9.489269e-01 [176] -2.403011e-01 -8.590301e-01 1.520118e+00 -1.449605e+00 -1.070709e+00 [181] -3.552929e-01 -3.381061e+00 -1.364158e+00 -5.765943e-01 -4.338542e-01 [186] -1.087825e+00 -4.275643e+00 -3.058681e+00 5.146584e-03 -1.310661e-02 [191] -9.087595e-01 -1.619560e+00 -4.190640e-01 1.243232e-01 -8.983106e-02 [196] 2.610868e+00 2.878732e-02 -4.186830e-01 -5.869390e-01 7.012304e+00 [201] -7.131388e-01 -4.117999e-01 -1.563962e+00 8.912275e-01 3.840525e-01 [206] 6.745131e+00 1.770830e+01 -3.334668e+00 -1.401753e+00 2.935563e-01 [211] 4.026982e+00 2.181024e+01 1.027859e+01 -1.051570e+00 -2.557811e+00 [216] -9.238512e-01 3.181792e+00 -1.780238e-01 -3.908639e+00 -3.019443e+00 [221] 2.002913e+00 -3.687211e+00 -3.199069e+00 -5.114728e+00 5.873360e-02 [226] -3.076284e+00 4.674283e-01 -1.358105e+00 -6.046901e+00 2.763281e+00 [231] -5.966468e-01 -2.138175e+00 -9.218263e-02 -1.196044e+00 3.796994e+00 [236] 1.551277e+01 -2.773221e-02 2.073562e+00 -1.286493e+00 -3.269579e+00 [241] -2.159164e+00 1.976421e+01 4.097746e+01 -1.625793e+01 2.151179e+01 [246] -4.347327e+00 -2.467263e+01 -2.687066e+00 -2.982258e+00 -3.207523e+00 [251] -1.101315e+01 -8.366978e-01 -3.157698e+00 7.661500e+00 -1.703986e+01 [256] 3.274878e+00 -1.097770e+01 7.380522e+00 -3.139456e+00 -6.576582e-01 [261] -1.113811e+01 1.094092e-01 4.706908e+00 3.083272e+00 -3.940527e+00 [266] -3.521386e+00 2.532440e+00 1.589212e+00 -1.217972e+00 -1.662825e+00 [271] -5.761862e+00 -9.585332e-01 -4.136828e+00 3.473054e-01 7.821506e+00 [276] 1.075508e+01 -1.159737e+01 -4.717190e+00 2.683927e+00 1.565984e+00 [281] -1.192491e+00 -8.613200e+00 -7.494141e-01 -2.927190e+00 4.453448e-02 [286] -1.197743e+00 6.417249e-01 -1.510299e+00 -2.767968e+00 -6.081147e+00 [291] 2.503309e+00 3.360163e+00 3.647360e+00 -1.322732e+01 4.664521e-01 [296] 1.396776e+00 4.254542e+00 -8.442717e+00 1.992846e+00 -1.446955e+00 [301] 5.396619e+00 -3.704927e+00 5.244458e+00 1.920224e+00 -3.837072e+00 [306] -3.240460e+00 -5.818713e+00 6.526613e-01 5.414127e+00 -2.188777e+00 [311] 1.486536e+00 -8.735033e+00 6.761044e+00 -1.307676e+00 -1.378585e+00 [316] 7.501728e-01 1.838037e+00 -2.846192e+00 4.188782e+00 -4.504093e+00 [321] 2.339068e+00 -2.429643e+00 2.209556e+00 4.481042e-01 6.790099e+00 [326] -1.111140e+00 2.555286e+00 -2.858044e+00 4.073645e+00 5.135067e+00 [331] -8.109648e+00 6.263441e-01 6.204651e+00 2.964935e-01 6.953318e+00 [336] 6.247717e+00 1.160789e+00 1.416130e+01 1.293556e+01 -6.702379e+00 [341] -2.620986e+00 -5.359383e+00 -4.468744e+00 2.802932e-01 -7.480189e+00 [346] 7.150790e+00 -1.419345e-01 -3.534703e-01 1.274321e+01 -9.529345e+00 [351] -2.041501e+00 9.385133e-01 4.882896e-01 -6.066046e+00 -9.621723e-01 [356] 4.373264e+00 -3.526411e+00 -2.793414e+00 > postscript(file="/var/www/html/rcomp/tmp/208t81260394735.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > acf(resid,length(resid)/2, main='Residual Autocorrelation Function') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3kwy11260394735.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > pacf(resid,length(resid)/2, main='Residual Partial Autocorrelation Function') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/45rsy1260394735.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > cpgram(resid, main='Residual Cumulative Periodogram') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/56cgt1260394735.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(resid, main='Residual Histogram', xlab='values of Residuals') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/661if1260394735.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~resid,col='black',main='Residual Density Plot', xlab='values of Residuals') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/7insl1260394735.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(resid, main='Residual Normal Q-Q Plot') > qqline(resid) > dev.off() null device 1 > ncols <- length(selection[[1]][1,]) > nrows <- length(selection[[2]][,1])-1 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'ARIMA Parameter Estimation and Backward Selection', ncols+1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Iteration', header=TRUE) > for (i in 1:ncols) { + a<-table.element(a,names(selection[[3]][[1]]$coef)[i],header=TRUE) + } > a<-table.row.end(a) > for (j in 1:nrows) { + a<-table.row.start(a) + mydum <- 'Estimates (' + mydum <- paste(mydum,j) + mydum <- paste(mydum,')') + a<-table.element(a,mydum, header=TRUE) + for (i in 1:ncols) { + a<-table.element(a,round(selection[[1]][j,i],4)) + } + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'(p-val)', header=TRUE) + for (i in 1:ncols) { + mydum <- '(' + mydum <- paste(mydum,round(selection[[2]][j,i],4),sep='') + mydum <- paste(mydum,')') + a<-table.element(a,mydum) + } + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/8zvqj1260394735.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Estimated ARIMA Residuals', 1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Value', 1,TRUE) > a<-table.row.end(a) > for (i in (par4*par5+par3):length(resid)) { + a<-table.row.start(a) + a<-table.element(a,resid[i]) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/9kc9a1260394735.tab") > > system("convert tmp/1phkp1260394735.ps tmp/1phkp1260394735.png") > system("convert tmp/208t81260394735.ps tmp/208t81260394735.png") > system("convert tmp/3kwy11260394735.ps tmp/3kwy11260394735.png") > system("convert tmp/45rsy1260394735.ps tmp/45rsy1260394735.png") > system("convert tmp/56cgt1260394735.ps tmp/56cgt1260394735.png") > system("convert tmp/661if1260394735.ps tmp/661if1260394735.png") > system("convert tmp/7insl1260394735.ps tmp/7insl1260394735.png") > > > proc.time() user system elapsed 82.937 13.808 97.746