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) > par9 = '0' > par8 = '0' > par7 = '0' > 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.4717640 -0.10167678 0.11731270 -0.07362019 0.009189242 -0.09766132 [2,] 0.4717622 -0.10162193 0.11728189 -0.07356467 0.009089015 -0.09753682 [3,] 0.4715465 -0.10149454 0.11728130 -0.07363333 0.008778897 -0.09750355 [4,] 0.4709555 -0.10053579 0.11607027 -0.06997009 0.000000000 -0.09386065 [5,] 0.4722074 -0.10064749 0.11674055 -0.07104508 0.000000000 -0.09936905 [6,] 0.4719791 -0.10284959 0.11453758 -0.07050738 0.000000000 -0.09561892 [7,] 0.4716713 -0.10235094 0.11723123 -0.06691450 0.000000000 -0.09621673 [8,] 0.4668596 -0.09548896 0.08802023 0.00000000 0.000000000 -0.10152379 [9,] 0.4611425 -0.05583575 0.00000000 0.00000000 0.000000000 -0.09446463 [10,] 0.4368198 0.00000000 0.00000000 0.00000000 0.000000000 -0.09527910 [11,] 0.4421631 0.00000000 0.00000000 0.00000000 0.000000000 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 [,7] [,8] [,9] [,10] [,11] [1,] -0.01247279 -0.0007317438 0.03983273 -0.06254067 0.003949623 [2,] -0.01280153 0.0000000000 0.03949120 -0.06239151 0.003853444 [3,] -0.01291754 0.0000000000 0.03921262 -0.06068874 0.000000000 [4,] -0.01375238 0.0000000000 0.03910340 -0.06066056 0.000000000 [5,] 0.00000000 0.0000000000 0.03861233 -0.06177889 0.000000000 [6,] 0.00000000 0.0000000000 0.00000000 -0.04595254 0.000000000 [7,] 0.00000000 0.0000000000 0.00000000 0.00000000 0.000000000 [8,] 0.00000000 0.0000000000 0.00000000 0.00000000 0.000000000 [9,] 0.00000000 0.0000000000 0.00000000 0.00000000 0.000000000 [10,] 0.00000000 0.0000000000 0.00000000 0.00000000 0.000000000 [11,] 0.00000000 0.0000000000 0.00000000 0.00000000 0.000000000 [12,] NA NA NA NA NA [13,] NA NA NA NA NA [14,] NA NA NA NA NA [15,] NA NA NA NA NA [16,] NA NA NA NA NA [17,] NA NA NA NA NA [18,] NA NA NA NA NA [19,] NA NA NA NA NA [20,] NA NA NA NA NA [21,] NA NA NA NA NA [22,] NA NA NA NA NA [[2]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 0 0.08328 0.04780 0.21630 0.87873 0.10531 0.83657 0.99036 0.50805 [2,] 0 0.08263 0.04763 0.21536 0.87874 0.10127 0.81435 NA 0.46695 [3,] 0 0.08287 0.04763 0.21489 0.88253 0.10136 0.81260 NA 0.46893 [4,] 0 0.08392 0.04776 0.19484 NA 0.08279 0.79969 NA 0.47010 [5,] 0 0.08358 0.04629 0.18681 NA 0.04498 NA NA 0.47547 [6,] 0 0.07688 0.05040 0.19060 NA 0.05249 NA NA NA [7,] 0 0.07870 0.04527 0.21351 NA 0.05134 NA NA NA [8,] 0 0.09991 0.10111 NA NA 0.03953 NA NA NA [9,] 0 0.29124 NA NA NA 0.05532 NA NA NA [10,] 0 NA NA NA NA 0.05360 NA NA NA [11,] 0 NA 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 [,10] [,11] [1,] 0.29587 0.94212 [2,] 0.29095 0.94306 [3,] 0.26083 NA [4,] 0.26106 NA [5,] 0.25085 NA [6,] 0.34871 NA [7,] NA NA [8,] NA NA [9,] NA NA [10,] NA NA [11,] NA NA [12,] NA NA [13,] NA NA [14,] NA NA [15,] NA NA [16,] NA NA [17,] NA NA [18,] NA NA [19,] NA NA [20,] NA NA [21,] NA NA [22,] 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.4718 -0.1017 0.1173 -0.0736 0.0092 -0.0977 -0.0125 -0.0007 s.e. 0.0530 0.0585 0.0591 0.0594 0.0602 0.0601 0.0604 0.0605 ar9 ar10 ar11 0.0398 -0.0625 0.0039 s.e. 0.0601 0.0597 0.0544 sigma^2 estimated as 109.8: log likelihood = -1345.51, aic = 2715.02 [[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.4718 -0.1017 0.1173 -0.0736 0.0092 -0.0977 -0.0125 -0.0007 s.e. 0.0530 0.0585 0.0591 0.0594 0.0602 0.0601 0.0604 0.0605 ar9 ar10 ar11 0.0398 -0.0625 0.0039 s.e. 0.0601 0.0597 0.0544 sigma^2 estimated as 109.8: log likelihood = -1345.51, aic = 2715.02 [[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.4718 -0.1016 0.1173 -0.0736 0.0091 -0.0975 -0.0128 0 0.0395 s.e. 0.0531 0.0584 0.0590 0.0593 0.0595 0.0594 0.0545 0 0.0542 ar10 ar11 -0.0624 0.0039 s.e. 0.0590 0.0539 sigma^2 estimated as 109.8: log likelihood = -1345.51, aic = 2713.02 [[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.4715 -0.1015 0.1173 -0.0736 0.0088 -0.0975 -0.0129 0 0.0392 s.e. 0.0529 0.0584 0.0590 0.0593 0.0594 0.0594 0.0544 0 0.0541 ar10 ar11 -0.0607 0 s.e. 0.0539 0 sigma^2 estimated as 109.8: log likelihood = -1345.51, aic = 2711.03 [[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.4710 -0.1005 0.1161 -0.0700 0 -0.0939 -0.0138 0 0.0391 s.e. 0.0528 0.0580 0.0584 0.0539 0 0.0540 0.0542 0 0.0541 ar10 ar11 -0.0607 0 s.e. 0.0539 0 sigma^2 estimated as 109.8: log likelihood = -1345.52, aic = 2709.05 [[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.4722 -0.1006 0.1167 -0.0710 0 -0.0994 0 0 0.0386 -0.0618 s.e. 0.0526 0.0580 0.0584 0.0537 0 0.0494 0 0 0.0540 0.0537 ar11 0 s.e. 0 sigma^2 estimated as 109.9: log likelihood = -1345.56, aic = 2707.11 [[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.4720 -0.1028 0.1145 -0.0705 0 -0.0956 0 0 0 -0.046 s.e. 0.0526 0.0580 0.0583 0.0538 0 0.0491 0 0 0 0.049 ar11 0 s.e. 0 sigma^2 estimated as 110.0: log likelihood = -1345.81, aic = 2705.62 [[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.4717 -0.1024 0.1172 -0.0669 0 -0.0962 0 0 0 0 0 s.e. 0.0527 0.0580 0.0583 0.0537 0 0.0492 0 0 0 0 0 sigma^2 estimated as 110.3: log likelihood = -1346.25, aic = 2704.5 [[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.4669 -0.0955 0.0880 0 0 -0.1015 0 0 0 0 0 s.e. 0.0527 0.0579 0.0535 0 0 0.0491 0 0 0 0 0 sigma^2 estimated as 110.8: log likelihood = -1347.03, aic = 2704.05 [[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 0.4611 -0.0558 0 0 0 -0.0945 0 0 0 0 0 s.e. 0.0528 0.0528 0 0 0 0.0491 0 0 0 0 0 sigma^2 estimated as 111.6: log likelihood = -1348.37, aic = 2704.74 [[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.4368 0 0 0 0 -0.0953 0 0 0 0 0 s.e. 0.0476 0 0 0 0 0.0492 0 0 0 0 0 sigma^2 estimated as 112.0: log likelihood = -1348.93, aic = 2703.86 $aic [1] 2715.023 2713.023 2711.028 2709.050 2707.115 2705.624 2704.503 2704.053 [9] 2704.744 2703.860 2705.588 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/1fwpz1260459906.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] 0.25499984 22.49949727 8.55870582 30.51526425 17.74568676 [6] 4.28798837 -11.69595377 -3.22064160 -1.34685327 0.38379724 [11] -5.55694882 1.60599628 -3.69455517 -1.86840234 -1.64676285 [16] -11.45499892 -1.26339991 -6.74615229 -2.17691265 -12.88417782 [21] -2.13911061 -1.87406284 0.50750000 -1.92626242 -4.15927742 [26] -3.64133341 -6.00938323 -0.86148942 -0.45688188 5.38703898 [31] 19.53724681 16.59932007 -1.48636040 -0.15113070 1.97855269 [36] 0.56948661 -10.67749946 13.33257963 -8.41717664 -1.77539381 [41] 4.72484507 -2.98308141 6.77086428 -5.58049368 -10.31281230 [46] -1.59996140 -11.03220498 -3.99102867 1.63825983 -14.45385986 [51] 0.26631883 -0.45963777 -2.91016600 1.30199633 -4.19492280 [56] -1.60116659 -0.72512335 0.57399590 -3.62245357 10.50263037 [61] -6.05532714 12.03382909 -3.96549692 -0.14239014 0.06406095 [66] -1.16089802 -2.28522673 3.65295913 -1.86305873 -1.65986855 [71] 0.15232509 0.72163545 1.20528072 0.98126916 -0.63230242 [76] -4.40650588 1.30521000 -0.57763253 -0.78856969 2.22031230 [81] -2.83617388 1.57035926 1.92506856 -3.32459080 5.23714074 [86] 3.72091152 -4.81212292 2.05628266 1.09185003 2.72252024 [91] 1.29035872 -1.22433249 1.39615985 0.42741336 -1.36927499 [96] 1.81397862 -0.20814997 1.93330463 -0.34977678 -0.88897673 [101] -0.55535117 0.94473494 0.08159010 -5.14048775 1.10957461 [106] 1.54796048 -1.65672506 -7.27185867 23.73577818 74.53710673 [111] -16.36351625 -15.60631694 -1.03443236 -2.23957973 -3.96801096 [116] -2.31729918 -11.75923910 6.21377024 3.97100518 -2.47744440 [121] -3.53344553 -7.83212643 -4.01659388 -7.11578358 -5.35088912 [126] 2.92366659 -2.72749946 -9.14224547 7.60358913 3.80077926 [131] -15.72938188 2.01797479 11.16830409 -5.03608724 -6.25945746 [136] 11.14911493 -6.30686164 -1.00908956 7.81754859 -6.97969904 [141] 2.15901101 1.84051123 2.87326792 1.54084809 3.04922506 [146] 6.68670266 -5.05826306 8.31078439 1.83270217 -1.38231402 [151] 5.99686056 -7.09509879 -5.06503590 -2.08709431 -10.42174152 [156] 9.33517896 -2.93256856 5.15913248 -10.19227246 2.06079195 [161] 4.27582407 1.90880398 5.80584458 -5.60617280 0.27434814 [166] 0.53019650 -8.21343068 3.68455679 1.30837697 2.16801852 [171] -8.85478730 6.41115202 -6.62033173 0.62757747 -5.49402262 [176] -5.18767356 -0.39540866 3.08366066 -4.34030366 -3.48235748 [181] 5.81553255 -0.65008583 -6.87853271 0.72326360 5.31553660 [186] -6.05407471 4.63856942 -4.88885527 -6.43949363 -1.36119979 [191] -7.67697123 1.37840315 0.23666703 10.15259528 -4.09231915 [196] 0.63442426 2.08245141 0.02651317 0.55570746 -4.50243873 [201] 1.49201414 -7.35130749 5.55972711 4.09475464 3.08986558 [206] -2.74143867 -1.42301339 -0.03162924 2.02782040 5.91785414 [211] 72.02443074 81.43476085 -52.08716611 0.17053147 3.73048613 [216] -10.79756505 13.04743495 -6.24662249 -5.64576927 3.02770622 [221] -0.34673937 -1.01019731 -2.69809760 2.23524617 -7.74888415 [226] -10.92616093 0.46036493 -4.04844229 -15.09661034 9.17301636 [231] -5.09190078 -1.80087697 -7.78123785 2.43487395 -7.20529232 [236] 3.65741767 -6.51793619 3.37073094 -7.37131829 5.00743333 [241] -2.30098629 2.00105296 18.35799746 29.74313890 4.23228109 [246] 22.73704411 5.99875297 -4.48394947 -5.12349088 -16.58887551 [251] 2.97694612 -7.27290056 -5.49157687 1.13139360 7.77601166 [256] -12.16469850 -5.71551744 -7.01472279 1.22294645 -6.54022160 [261] -4.90163275 -8.73577899 2.23903099 -3.55924611 0.32963264 [266] -0.85786817 4.30542944 -4.21150049 3.13673370 -9.00978217 [271] 3.02765952 0.77698661 -3.39211617 10.33359021 -18.11138685 [276] 6.62882180 18.85365229 5.34560111 -10.71790812 -2.13000891 [281] -4.54112989 -7.58957596 7.70708459 0.45009393 -10.83186407 [286] 1.91974034 -6.94397565 -0.82032444 2.69706003 -1.24323958 [291] -1.89465666 -7.38543025 -0.44155285 6.95877618 -8.36290191 [296] -2.58945854 0.01344607 -0.81632747 -2.55854540 -5.75843986 [301] 5.01400184 -0.49060894 -9.33690591 15.40505317 -1.86804524 [306] -9.54346254 7.30792647 -6.40831813 0.46780690 -3.43577872 [311] 3.47389387 -5.53235721 18.39359561 -14.99013847 4.09992523 [316] 6.63999460 -10.28086941 2.08219256 3.09608535 -3.58245897 [321] 0.89043673 -8.59804281 -1.17037546 11.55220363 -2.36960727 [326] -4.56173559 9.15349547 -6.61545401 -7.08991632 -3.82180819 [331] 16.50021486 -5.93429821 0.32412114 -3.45394191 -5.44846173 [336] 1.73652208 28.60693641 -22.82518058 11.62322420 19.76199444 [341] -1.78126781 4.79324795 -9.39921291 17.34338021 -9.30750729 [346] 3.72981645 -14.55201603 1.75595309 1.45226625 -4.25882342 [351] 14.90007801 -6.44761148 4.62583972 -22.14249163 7.91467448 [356] 3.82210916 -2.92459863 -2.58106564 > postscript(file="/var/www/html/rcomp/tmp/2yfxz1260459906.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/3h9681260459906.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/466to1260459906.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/5sgwx1260459906.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/61kyv1260459906.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/7etvd1260459906.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/8b9z41260459906.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/9yn961260459906.tab") > > system("convert tmp/1fwpz1260459906.ps tmp/1fwpz1260459906.png") > system("convert tmp/2yfxz1260459906.ps tmp/2yfxz1260459906.png") > system("convert tmp/3h9681260459906.ps tmp/3h9681260459906.png") > system("convert tmp/466to1260459906.ps tmp/466to1260459906.png") > system("convert tmp/5sgwx1260459906.ps tmp/5sgwx1260459906.png") > system("convert tmp/61kyv1260459906.ps tmp/61kyv1260459906.png") > system("convert tmp/7etvd1260459906.ps tmp/7etvd1260459906.png") > > > proc.time() user system elapsed 4.356 1.141 8.775