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(255 + ,280.2 + ,299.9 + ,339.2 + ,374.2 + ,393.5 + ,389.2 + ,381.7 + ,375.2 + ,369 + ,357.4 + ,352.1 + ,346.5 + ,342.9 + ,340.3 + ,328.3 + ,322.9 + ,314.3 + ,308.9 + ,294 + ,285.6 + ,281.2 + ,280.3 + ,278.8 + ,274.5 + ,270.4 + ,263.4 + ,259.9 + ,258 + ,262.7 + ,284.7 + ,311.3 + ,322.1 + ,327 + ,331.3 + ,333.3 + ,321.4 + ,327 + ,320 + ,314.7 + ,316.7 + ,314.4 + ,321.3 + ,318.2 + ,307.2 + ,301.3 + ,287.5 + ,277.7 + ,274.4 + ,258.8 + ,253.3 + ,251 + ,248.4 + ,249.5 + ,246.1 + ,244.5 + ,243.6 + ,244 + ,240.8 + ,249.8 + ,248 + ,259.4 + ,260.5 + ,260.8 + ,261.3 + ,259.5 + ,256.6 + ,257.9 + ,256.5 + ,254.2 + ,253.3 + ,253.8 + ,255.5 + ,257.1 + ,257.3 + ,253.2 + ,252.8 + ,252 + ,250.7 + ,252.2 + ,250 + ,251 + ,253.4 + ,251.2 + ,255.6 + ,261.1 + ,258.9 + ,259.9 + ,261.2 + ,264.7 + ,267.1 + ,266.4 + ,267.7 + ,268.6 + ,267.5 + ,268.5 + ,268.5 + ,270.5 + ,270.9 + ,270.1 + ,269.3 + ,269.8 + ,270.1 + ,264.9 + ,263.7 + ,264.8 + ,263.7 + ,255.9 + ,276.2 + ,360.1 + ,380.5 + ,373.7 + ,369.8 + ,366.6 + ,359.3 + ,345.8 + ,326.2 + ,324.5 + ,328.1 + ,327.5 + ,324.4 + ,316.5 + ,310.9 + ,301.5 + ,291.7 + ,290.4 + ,287.4 + ,277.7 + ,281.6 + ,288 + ,276 + ,272.9 + ,283 + ,283.3 + ,276.8 + ,284.5 + ,282.7 + ,281.2 + ,287.4 + ,283.1 + ,284 + ,285.5 + ,289.2 + ,292.5 + ,296.4 + ,305.2 + ,303.9 + ,311.5 + ,316.3 + ,316.7 + ,322.5 + ,317.1 + ,309.8 + ,303.8 + ,290.3 + ,293.7 + ,291.7 + ,296.5 + ,289.1 + ,288.5 + ,293.8 + ,297.7 + ,305.4 + ,302.7 + ,302.5 + ,303 + ,294.5 + ,294.1 + ,294.5 + ,297.1 + ,289.4 + ,292.4 + ,287.9 + ,286.6 + ,280.5 + ,272.4 + ,269.2 + ,270.6 + ,267.3 + ,262.5 + ,266.8 + ,268.8 + ,263.1 + ,261.2 + ,266 + ,262.5 + ,265.2 + ,261.3 + ,253.7 + ,249.2 + ,239.1 + ,236.4 + ,235.2 + ,245.2 + ,246.2 + ,247.7 + ,251.4 + ,253.3 + ,254.8 + ,250 + ,249.3 + ,241.5 + ,243.3 + ,248 + ,253 + ,252.9 + ,251.5 + ,251.6 + ,253.5 + ,259.8 + ,334.1 + ,448 + ,445.8 + ,445 + ,448.2 + ,438.2 + ,439.8 + ,423.4 + ,410.8 + ,408.4 + ,406.7 + ,405.9 + ,402.7 + ,405.1 + ,399.6 + ,386.5 + ,381.4 + ,375.2 + ,357.7 + ,359 + ,355 + ,352.7 + ,344.4 + ,343.8 + ,338 + ,339 + ,333.3 + ,334.4 + ,328.3 + ,330.7 + ,330 + ,331.6 + ,351.2 + ,389.4 + ,410.9 + ,442.8 + ,462.8 + ,466.9 + ,461.7 + ,439.2 + ,430.3 + ,416.1 + ,402.5 + ,397.3 + ,403.3 + ,395.9 + ,387.8 + ,378.6 + ,377.1 + ,370.4 + ,362 + ,350.3 + ,348.2 + ,344.6 + ,343.5 + ,342.8 + ,347.6 + ,346.6 + ,349.5 + ,342.1 + ,342 + ,342.8 + ,339.3 + ,348.2 + ,333.7 + ,334.7 + ,354 + ,367.7 + ,363.3 + ,358.4 + ,353.1 + ,343.1 + ,344.6 + ,344.4 + ,333.9 + ,331.7 + ,324.3 + ,321.2 + ,322.4 + ,321.7 + ,320.5 + ,312.8 + ,309.7 + ,315.6 + ,309.7 + ,304.6 + ,302.5 + ,301.5 + ,298.8 + ,291.3 + ,293.6 + ,294.6 + ,285.9 + ,297.6 + ,301.1 + ,293.8 + ,297.7 + ,292.9 + ,292.1 + ,287.2 + ,288.2 + ,283.8 + ,299.9 + ,292.4 + ,293.3 + ,300.8 + ,293.7 + ,293.1 + ,294.4 + ,292.1 + ,291.9 + ,282.5 + ,277.9 + ,287.5 + ,289.2 + ,285.6 + ,293.2 + ,290.8 + ,283.1 + ,275 + ,287.8 + ,287.8 + ,287.4 + ,284 + ,277.8 + ,277.6 + ,304.9 + ,294 + ,300.9 + ,324 + ,332.9 + ,341.6 + ,333.4 + ,348.2 + ,344.7 + ,344.7 + ,329.3 + ,323.5 + ,323.2 + ,317.4 + ,330.1 + ,329.2 + ,334.9 + ,315.8 + ,315.4 + ,319.6 + ,317.3 + ,313.8 + ,315.8 + ,311.3) > par9 = '0' > par8 = '0' > 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.24126256 0.2340404 0.04545871 0.01107044 -0.04522462 -0.08757026 [2,] -0.21444654 0.2230570 0.04670015 0.00000000 -0.04471529 -0.08626308 [3,] -0.19488972 0.2133053 0.04910583 0.00000000 -0.04222369 -0.08645417 [4,] -0.19063772 0.2126150 0.04993283 0.00000000 -0.04240649 -0.08864172 [5,] -0.09760571 0.1662270 0.05543491 0.00000000 0.00000000 -0.08613676 [6,] 0.00000000 0.1192357 0.06717243 0.00000000 0.00000000 -0.09005448 [7,] 0.00000000 0.1165129 0.06397333 0.00000000 0.00000000 -0.08761449 [8,] 0.00000000 0.1162086 0.06738799 0.00000000 0.00000000 -0.08675263 [9,] 0.00000000 0.1180872 0.06825528 0.00000000 0.00000000 -0.08573709 [10,] 0.00000000 0.1250979 0.00000000 0.00000000 0.00000000 -0.08110325 [11,] 0.00000000 0.1293081 0.00000000 0.00000000 0.00000000 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 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -0.08004536 -0.01193568 0.04037644 -0.04679873 -0.01230384 0.7146694 [2,] -0.07719108 -0.01142668 0.04011064 -0.04880762 -0.01039287 0.6881189 [3,] -0.07550402 -0.01159875 0.03857559 -0.04759668 0.00000000 0.6688960 [4,] -0.07321609 0.00000000 0.04053957 -0.04966305 0.00000000 0.6653901 [5,] -0.07109757 0.00000000 0.04063686 -0.05202062 0.00000000 0.5718243 [6,] -0.06234540 0.00000000 0.03954006 -0.05245932 0.00000000 0.4748279 [7,] -0.05875667 0.00000000 0.00000000 -0.05317787 0.00000000 0.4736481 [8,] -0.06242396 0.00000000 0.00000000 0.00000000 0.00000000 0.4694978 [9,] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.4716654 [10,] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.4870775 [11,] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.4926741 [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 [[2]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 0.40321 0.10517 0.46968 0.8656 0.45605 0.12184 0.20354 0.83446 0.47795 [2,] 0.44220 0.12737 0.47003 NA 0.46928 0.12172 0.20876 0.84011 0.47712 [3,] 0.45464 0.12018 0.43643 NA 0.48085 0.11916 0.21220 0.83689 0.48685 [4,] 0.47616 0.13138 0.42987 NA 0.47987 0.10287 0.21483 NA 0.45707 [5,] 0.76511 0.32539 0.42782 NA NA 0.12284 0.25311 NA 0.45357 [6,] NA 0.04031 0.21538 NA NA 0.09237 0.24702 NA 0.46475 [7,] NA 0.04465 0.23683 NA NA 0.10097 0.27377 NA NA [8,] NA 0.04510 0.21245 NA NA 0.10474 0.24481 NA NA [9,] NA 0.04248 0.20832 NA NA 0.11113 NA NA NA [10,] NA 0.02992 NA NA NA 0.13075 NA NA NA [11,] NA 0.02543 NA NA NA NA NA 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 [,10] [,11] [,12] [1,] 0.41909 0.84027 0.01196 [2,] 0.38478 0.86092 0.01269 [3,] 0.39336 NA 0.00967 [4,] 0.36299 NA 0.01240 [5,] 0.33323 NA 0.08082 [6,] 0.33012 NA 0.00000 [7,] 0.32498 NA 0.00000 [8,] NA NA 0.00000 [9,] NA NA 0.00000 [10,] NA NA 0.00000 [11,] NA NA 0.00000 [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 [[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.2413 0.2340 0.0455 0.0111 -0.0452 -0.0876 -0.0800 -0.0119 s.e. 0.2883 0.1441 0.0628 0.0654 0.0606 0.0565 0.0628 0.0571 ar9 ar10 ar11 ma1 0.0404 -0.0468 -0.0123 0.7147 s.e. 0.0568 0.0579 0.0610 0.2829 sigma^2 estimated as 109.2: log likelihood = -1352.1, aic = 2730.19 [[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.2413 0.2340 0.0455 0.0111 -0.0452 -0.0876 -0.0800 -0.0119 s.e. 0.2883 0.1441 0.0628 0.0654 0.0606 0.0565 0.0628 0.0571 ar9 ar10 ar11 ma1 0.0404 -0.0468 -0.0123 0.7147 s.e. 0.0568 0.0579 0.0610 0.2829 sigma^2 estimated as 109.2: log likelihood = -1352.1, aic = 2730.19 [[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.2144 0.2231 0.0467 0 -0.0447 -0.0863 -0.0772 -0.0114 0.0401 s.e. 0.2787 0.1460 0.0646 0 0.0617 0.0556 0.0613 0.0566 0.0564 ar10 ar11 ma1 -0.0488 -0.0104 0.6881 s.e. 0.0561 0.0593 0.2746 sigma^2 estimated as 109.3: log likelihood = -1352.11, aic = 2728.22 [[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.1949 0.2133 0.0491 0 -0.0422 -0.0865 -0.0755 -0.0116 0.0386 s.e. 0.2604 0.1369 0.0630 0 0.0598 0.0553 0.0604 0.0563 0.0554 ar10 ar11 ma1 -0.0476 0 0.6689 s.e. 0.0557 0 0.2571 sigma^2 estimated as 109.3: log likelihood = -1352.13, aic = 2726.25 [[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.1906 0.2126 0.0499 0 -0.0424 -0.0886 -0.0732 0 0.0405 s.e. 0.2673 0.1406 0.0632 0 0.0600 0.0542 0.0589 0 0.0545 ar10 ar11 ma1 -0.0497 0 0.6654 s.e. 0.0545 0 0.2647 sigma^2 estimated as 109.3: log likelihood = -1352.15, aic = 2724.29 [[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 ar10 -0.0976 0.1662 0.0554 0 0 -0.0861 -0.0711 0 0.0406 -0.0520 s.e. 0.3264 0.1688 0.0698 0 0 0.0557 0.0621 0 0.0542 0.0537 ar11 ma1 0 0.5718 s.e. 0 0.3266 sigma^2 estimated as 109.4: log likelihood = -1352.4, aic = 2722.79 [[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 ar10 0 0.1192 0.0672 0 0 -0.0901 -0.0623 0 0.0395 -0.0525 s.e. 0 0.0579 0.0541 0 0 0.0534 0.0538 0 0.0540 0.0538 ar11 ma1 0 0.4748 s.e. 0 0.0531 sigma^2 estimated as 109.5: log likelihood = -1352.44, aic = 2720.87 [[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 ar11 0 0.1165 0.064 0 0 -0.0876 -0.0588 0 0 -0.0532 0 s.e. 0 0.0578 0.054 0 0 0.0533 0.0536 0 0 0.0540 0 ma1 0.4736 s.e. 0.0532 sigma^2 estimated as 109.6: log likelihood = -1352.7, aic = 2719.41 [[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 ar11 0 0.1162 0.0674 0 0 -0.0868 -0.0624 0 0 0 0 s.e. 0 0.0578 0.0539 0 0 0.0533 0.0536 0 0 0 0 ma1 0.4695 s.e. 0.0528 sigma^2 estimated as 109.9: log likelihood = -1353.19, aic = 2718.38 [[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 ar11 ma1 0 0.1181 0.0683 0 0 -0.0857 0 0 0 0 0 0.4717 s.e. 0 0.0580 0.0542 0 0 0.0537 0 0 0 0 0 0.0530 sigma^2 estimated as 110.4: log likelihood = -1353.87, aic = 2717.73 [[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 ma1 0 0.1251 0 0 0 -0.0811 0 0 0 0 0 0.4871 s.e. 0 0.0574 0 0 0 0.0535 0 0 0 0 0 0.0537 sigma^2 estimated as 110.8: log likelihood = -1354.66, aic = 2717.31 [[3]][[12]] NULL $aic [1] 2730.191 2728.220 2726.251 2724.294 2722.794 2720.872 2719.407 2718.376 [9] 2717.731 2717.313 2717.601 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/1aadk1260624615.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 = 360 Frequency = 1 [1] 0.2549998 22.4034064 8.4701074 31.8945029 17.0058543 6.2808755 [7] -10.8039095 -2.6226303 -3.0873207 -0.5708815 -7.6701228 0.7768054 [13] -4.8759694 -1.1702819 -1.8566051 -11.1481772 -0.5855173 -7.2434804 [19] -1.6505135 -13.3122020 -1.4512662 -2.8024015 1.0778513 -2.1720544 [25] -3.5674107 -3.3831863 -5.4954726 -0.6672321 -0.7723140 5.3923645 [31] 19.2624427 16.2972147 -0.4578824 1.5115591 2.0586003 0.7655078 [37] -11.0265109 12.8779159 -10.9079628 -0.2901192 3.3657397 -3.1141507 [43] 7.2015082 -5.8657891 -9.5738044 -1.2788593 -11.6388132 -3.5794562 [49] 0.7294357 -14.9807526 1.3174743 -1.4686943 -2.3158186 1.7208963 [55] -4.1805961 -0.9665443 -0.4499532 0.6327812 -3.6064938 10.7958163 [61] -6.9338368 13.5216696 -5.3339174 1.5043565 -0.6298762 -0.8008015 [67] -2.7184824 3.7738648 -2.7861671 -1.0812170 -0.1576749 0.7185392 [73] 1.2274044 1.0450442 -0.6352285 -4.1772886 1.5366507 -0.9950150 [79] -0.6274359 2.0354534 -3.0125756 1.9471876 1.6943428 -3.2152567 [85] 5.5604100 3.1885198 -4.4819140 2.5761043 0.5151008 2.9455810 [91] 1.1595009 -1.2565415 1.4333710 0.3705091 -1.3376596 1.8228172 [97] -0.5555977 2.0887490 -0.5119483 -0.7278443 -0.5847362 0.9659934 [103] -0.0704353 -5.0660350 1.2624635 1.0707089 -1.5362833 -7.1487670 [109] 23.9439420 72.7914717 -17.6918972 -8.5891742 -2.3576171 -1.8335976 [115] -4.2726181 -4.2140277 -14.9797211 6.7336040 2.4558290 -1.8430430 [121] -3.2447014 -7.3394142 -3.2269570 -6.9778242 -5.4087392 2.4617332 [127] -3.2245156 -8.6074995 8.0136346 2.9478180 -14.7185094 3.1629937 [133] 9.8172418 -4.8806555 -5.0699286 10.6509795 -7.1479550 0.7669341 [139] 6.8707627 -7.4346160 3.2184559 1.0947786 2.9081841 1.5741873 [145] 3.1732268 6.4928257 -4.8773980 8.9964642 0.8807342 -0.7120890 [151] 5.8626754 -7.5919076 -4.4331548 -2.5487969 -10.9560283 9.5194632 [157] -4.4774958 6.1175970 -10.7216017 3.5351613 3.4089330 2.5903953 [163] 5.6130515 -5.5325771 0.9313759 0.3354501 -8.2085234 3.8519406 [169] 0.2116336 2.3279784 -8.9001657 7.0503673 -7.6601991 2.0233755 [175] -6.4901588 -4.5652941 -0.8377460 3.0646498 -4.7573733 -2.7633619 [181] 5.5640645 -0.7665970 -6.1240592 0.9462401 4.7845250 -5.9820440 [187] 5.3619930 -5.9116569 -5.5206179 -1.4772458 -8.0404273 1.4953901 [193] -0.4459034 10.2386511 -4.4532836 2.0531507 1.7557158 0.6382048 [199] 0.6289588 -4.5330051 1.4013811 -7.7604564 5.9675941 2.9231790 [205] 3.4726640 -2.7687121 -0.7336844 -0.1627345 2.3003872 5.5482087 [211] 71.7654228 78.1484521 -49.6726679 9.1538992 -0.8293466 -8.9850152 [217] 11.6020571 -11.5624612 -7.3467694 3.1651686 -1.4059186 -0.6260064 [223] -2.5526548 2.4133256 -7.2970643 -10.0406471 0.3407358 -4.7920651 [229] -14.7874242 9.4728759 -6.8708795 -0.1784293 -8.1263262 3.1430354 [235] -7.7118963 4.9367839 -7.7034415 4.5405375 -8.2716926 6.2426855 [241] -3.4479733 3.0602985 17.7346775 29.4508950 4.2084841 25.2660509 [247] 4.9470990 -2.1704777 -5.0551431 -17.4525107 1.9949538 -9.7698009 [253] -6.1059138 -0.1170336 7.3365987 -12.1478062 -3.6554835 -7.6454382 [259] 2.1342093 -7.0103617 -4.3111444 -9.3621470 2.8539768 -4.2726125 [265] 1.1221440 -1.3396105 4.9088344 -4.2523222 4.2004237 -9.6128056 [271] 4.1301836 -0.3427674 -2.9312403 10.1465596 -18.7691186 8.4284797 [277] 17.0004864 5.3592307 -9.7086111 -1.1631762 -5.3590096 -6.6956643 [283] 6.9896188 -1.2423925 -10.4393598 2.5123906 -7.7400484 0.1341860 [289] 2.1820202 -1.3912301 -1.5240648 -7.0485210 -0.1168708 6.6687587 [295] -8.6630748 -1.6752612 -0.6432644 -0.6731763 -2.3608255 -5.7464880 [301] 4.9582399 -0.8904395 -8.7243290 15.7432230 -3.2987965 -7.7651502 [307] 7.4309246 -7.4251182 1.6231278 -4.1412111 3.4010303 -6.0356394 [313] 19.2310288 -16.7058659 6.9580925 4.6516981 -9.3972222 2.6820868 [319] 2.1875733 -3.8987334 1.6093509 -9.2878790 -0.6268969 11.0326055 [325] -2.9928491 -3.5297278 9.0903638 -7.1397297 -5.5462174 -4.3197363 [331] 16.0051755 -7.0744393 2.0609319 -4.5984813 -4.5346392 1.7771171 [337] 28.2481348 -24.6340106 15.4510582 16.6619534 -0.5816778 6.0773404 [343] -10.0593879 17.7273242 -10.5491652 5.1602973 -16.7538030 3.0659984 [349] -0.5319180 -3.6150188 14.2144622 -7.0979766 6.3195313 -22.5359121 [355] 9.8393463 1.3264467 -1.8660318 -3.1895020 4.3035482 -7.7073910 > postscript(file="/var/www/html/rcomp/tmp/2gu011260624615.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/3hts51260624615.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/42eek1260624615.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/53ma01260624615.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/6m3k41260624615.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/7tq4n1260624615.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/88rdp1260624615.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/9zniq1260624615.tab") > system("convert tmp/1aadk1260624615.ps tmp/1aadk1260624615.png") > system("convert tmp/2gu011260624615.ps tmp/2gu011260624615.png") > system("convert tmp/3hts51260624615.ps tmp/3hts51260624615.png") > system("convert tmp/42eek1260624615.ps tmp/42eek1260624615.png") > system("convert tmp/53ma01260624615.ps tmp/53ma01260624615.png") > system("convert tmp/6m3k41260624615.ps tmp/6m3k41260624615.png") > system("convert tmp/7tq4n1260624615.ps tmp/7tq4n1260624615.png") > > > proc.time() user system elapsed 9.408 1.133 10.226