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(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 = '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.4685573 -0.11167941 0.11015737 -0.07736070 0.009182746 -0.08865425 [2,] 0.4685305 -0.11189560 0.11030275 -0.07760146 0.009601620 -0.08910469 [3,] 0.4682797 -0.11173798 0.11031342 -0.07766907 0.009267113 -0.08909600 [4,] 0.4677004 -0.11066017 0.10904757 -0.07378915 0.000000000 -0.08532430 [5,] 0.4691765 -0.11078214 0.10986224 -0.07509875 0.000000000 -0.09177631 [6,] 0.4690030 -0.11282252 0.10777107 -0.07444474 0.000000000 -0.08854239 [7,] 0.4685674 -0.11248100 0.11026246 -0.07088740 0.000000000 -0.08916423 [8,] 0.4629809 -0.10520893 0.07944148 0.00000000 0.000000000 -0.09457317 [9,] 0.4573609 -0.07093856 0.00000000 0.00000000 0.000000000 -0.08792256 [10,] 0.4284472 0.00000000 0.00000000 0.00000000 0.000000000 -0.08948276 [11,] 0.4329750 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.01672712 0.003192879 0.03640321 -0.05959928 0.004069185 [2,] -0.01536950 0.000000000 0.03773093 -0.06005183 0.004405772 [3,] -0.01550430 0.000000000 0.03741881 -0.05810654 0.000000000 [4,] -0.01634803 0.000000000 0.03733264 -0.05810087 0.000000000 [5,] 0.00000000 0.000000000 0.03665615 -0.05936604 0.000000000 [6,] 0.00000000 0.000000000 0.00000000 -0.04442273 0.000000000 [7,] 0.00000000 0.000000000 0.00000000 0.00000000 0.000000000 [8,] 0.00000000 0.000000000 0.00000000 0.00000000 0.000000000 [9,] 0.00000000 0.000000000 0.00000000 0.00000000 0.000000000 [10,] 0.00000000 0.000000000 0.00000000 0.00000000 0.000000000 [11,] 0.00000000 0.000000000 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.05852 0.06327 0.19346 0.87741 0.13531 0.78003 0.95749 0.54091 [2,] 0 0.05741 0.06265 0.19092 0.87076 0.12927 0.77680 NA 0.48421 [3,] 0 0.05762 0.06262 0.19049 0.87492 0.12930 0.77479 NA 0.48675 [4,] 0 0.05837 0.06318 0.17141 NA 0.11142 0.76176 NA 0.48773 [5,] 0 0.05811 0.06101 0.16268 NA 0.06222 NA NA 0.49534 [6,] 0 0.05351 0.06588 0.16673 NA 0.07083 NA NA NA [7,] 0 0.05453 0.05994 0.18719 NA 0.06921 NA NA NA [8,] 0 0.07136 0.13992 NA NA 0.05378 NA NA NA [9,] 0 0.18593 NA NA NA 0.07253 NA NA NA [10,] 0 NA NA NA NA 0.06820 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.31615 0.94012 [2,] 0.30697 0.93471 [3,] 0.27949 NA [4,] 0.27955 NA [5,] 0.26787 NA [6,] 0.36377 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.4686 -0.1117 0.1102 -0.0774 0.0092 -0.0887 -0.0167 0.0032 s.e. 0.0533 0.0588 0.0591 0.0594 0.0595 0.0592 0.0598 0.0599 ar9 ar10 ar11 0.0364 -0.0596 0.0041 s.e. 0.0595 0.0594 0.0541 sigma^2 estimated as 109.2: log likelihood = -1344.52, aic = 2713.04 [[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.4686 -0.1117 0.1102 -0.0774 0.0092 -0.0887 -0.0167 0.0032 s.e. 0.0533 0.0588 0.0591 0.0594 0.0595 0.0592 0.0598 0.0599 ar9 ar10 ar11 0.0364 -0.0596 0.0041 s.e. 0.0595 0.0594 0.0541 sigma^2 estimated as 109.2: log likelihood = -1344.52, aic = 2713.04 [[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.4685 -0.1119 0.1103 -0.0776 0.0096 -0.0891 -0.0154 0 0.0377 s.e. 0.0533 0.0587 0.0591 0.0592 0.0590 0.0586 0.0542 0 0.0539 ar10 ar11 -0.0601 0.0044 s.e. 0.0587 0.0537 sigma^2 estimated as 109.2: log likelihood = -1344.52, aic = 2711.04 [[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.4683 -0.1117 0.1103 -0.0777 0.0093 -0.0891 -0.0155 0 0.0374 s.e. 0.0532 0.0587 0.0591 0.0592 0.0588 0.0586 0.0541 0 0.0537 ar10 ar11 -0.0581 0 s.e. 0.0536 0 sigma^2 estimated as 109.2: log likelihood = -1344.53, aic = 2709.05 [[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.4677 -0.1107 0.1090 -0.0738 0 -0.0853 -0.0163 0 0.0373 s.e. 0.0531 0.0583 0.0585 0.0538 0 0.0535 0.0539 0 0.0537 ar10 ar11 -0.0581 0 s.e. 0.0536 0 sigma^2 estimated as 109.2: log likelihood = -1344.54, aic = 2707.08 [[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.4692 -0.1108 0.1099 -0.0751 0 -0.0918 0 0 0.0367 -0.0594 s.e. 0.0529 0.0583 0.0585 0.0537 0 0.0491 0 0 0.0537 0.0535 ar11 0 s.e. 0 sigma^2 estimated as 109.3: log likelihood = -1344.58, aic = 2705.17 [[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.4690 -0.1128 0.1078 -0.0744 0 -0.0885 0 0 0 -0.0444 s.e. 0.0529 0.0582 0.0584 0.0537 0 0.0489 0 0 0 0.0488 ar11 0 s.e. 0 sigma^2 estimated as 109.4: log likelihood = -1344.82, aic = 2703.63 [[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.4686 -0.1125 0.1103 -0.0709 0 -0.0892 0 0 0 0 0 s.e. 0.0530 0.0583 0.0584 0.0536 0 0.0489 0 0 0 0 0 sigma^2 estimated as 109.7: log likelihood = -1345.23, aic = 2702.46 [[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.4630 -0.1052 0.0794 0 0 -0.0946 0 0 0 0 0 s.e. 0.0529 0.0582 0.0537 0 0 0.0489 0 0 0 0 0 sigma^2 estimated as 110.2: log likelihood = -1346.1, aic = 2702.2 [[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.4574 -0.0709 0 0 0 -0.0879 0 0 0 0 0 s.e. 0.0530 0.0535 0 0 0 0.0488 0 0 0 0 0 sigma^2 estimated as 110.9: log likelihood = -1347.19, aic = 2702.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.4284 0 0 0 0 -0.0895 0 0 0 0 0 s.e. 0.0484 0 0 0 0 0.0489 0 0 0 0 0 sigma^2 estimated as 111.5: log likelihood = -1348.07, aic = 2702.14 $aic [1] 2713.042 2711.045 2709.051 2707.076 2705.168 2703.634 2702.460 2702.202 [9] 2702.383 2702.135 2703.464 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/1rsb91260473170.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.299899814 35.281160473 17.959232819 4.257612801 -12.305783787 [6] -4.959328777 -1.734824677 0.101579480 -5.811730552 1.397005283 [11] -3.714005452 -1.871816102 -1.639227838 -11.440830257 -1.296633032 [16] -6.760643485 -2.216457123 -12.908522797 -2.248791197 -1.874836222 [21] 0.501960993 -1.883949194 -4.140536022 -3.590969930 -5.995021454 [26] -0.894593409 -0.480969119 5.379825632 19.601522083 16.807281271 [31] -1.223076060 -0.040419914 2.030591253 0.578245801 -10.788273824 [36] 13.078763588 -8.432890797 -1.862403762 4.655546264 -2.977928978 [41] 6.820583850 -5.555182558 -10.298192840 -1.661338905 -11.093195730 [46] -4.093238341 1.516214044 -14.463520635 0.199466710 -0.471488415 [51] -2.849433389 1.337031815 -4.166585072 -1.539210382 -0.706639573 [56] 0.579792179 -3.604034069 10.469462222 -5.960266594 12.028032631 [61] -3.864833092 -0.135498868 0.085121001 -1.208878804 -2.289863920 [66] 3.562600453 -1.858550387 -1.673329028 0.130170046 0.724533558 [71] 1.226276379 0.987967266 -0.610791455 -4.391499792 1.276099229 [76] -0.583879723 -0.805121515 2.200153833 -2.824774318 1.575704636 [81] 1.935759650 -3.299859598 5.226256357 3.749056252 -4.753321923 [86] 2.032066700 1.086311372 2.746156513 1.294158771 -1.236118224 [91] 1.403051006 0.432501337 -1.369274937 1.784481623 -0.213688628 [96] 1.937362070 -0.340566908 -0.890844417 -0.555673236 0.932240555 [101] 0.085776377 -5.149568659 1.063718785 1.542550490 -1.642878177 [106] -7.283966650 23.668733350 74.737210556 -15.654103289 -15.441892795 [111] -1.084989757 -2.227021249 -4.112468830 -2.864731730 -11.990513915 [116] 6.089083279 3.979377564 -2.428754912 -3.496155783 -7.779830765 [121] -3.969128804 -7.152816108 -5.450457955 2.845093361 -2.720415128 [126] -9.121572046 7.554834848 3.887917816 -15.618993403 1.925039373 [131] 11.159738191 -4.895299939 -6.279551419 11.057596751 -6.172836890 [136] -1.006191505 7.746446723 -6.929528101 2.160685235 1.803414712 [141] 2.896260166 1.580521051 3.040917184 6.744279881 -4.989801287 [146] 8.291205557 1.874887130 -1.361253683 5.977603856 -7.097545762 [151] -5.102712454 -2.192266142 -10.499799284 9.219830931 -2.937720643 [156] 5.173687601 -10.109770914 2.033613078 4.349051119 1.933470970 [161] 5.850090223 -5.569526561 0.294635158 0.531999795 -8.239965007 [166] 3.590784350 1.260396133 2.187017656 -8.831859392 6.343785177 [171] -6.545945180 0.592219506 -5.507225476 -5.253816626 -0.418594538 [176] 3.039479462 -4.302498555 -3.502451672 5.810701961 -0.567133497 [181] -6.843239318 0.667425166 5.318756668 -5.986064020 4.584341221 [186] -4.877842050 -6.439107458 -1.413818166 -7.742470154 1.314127537 [191] 0.198411011 10.165153941 -3.964541423 0.668880344 2.153553277 [196] 0.073141742 0.578570922 -4.547843293 1.446029541 -7.365862791 [201] 5.472974726 4.098812196 3.120522078 -2.671753469 -1.419793206 [206] 0.001860635 2.018224239 5.906519193 72.048196136 82.057421311 [211] -51.125417235 0.151532218 3.712775037 -10.807289815 12.533041362 [216] -6.893429492 -5.770327225 2.926849099 -0.385381784 -0.966467258 [221] -2.714069790 2.303513962 -7.655756139 -10.958298763 0.360538241 [226] -4.086505249 -15.129971896 9.012585432 -5.049136588 -1.758435140 [231] -7.770933397 2.401319048 -7.108879912 3.601321615 -6.486378277 [236] 3.336338962 -7.313998860 4.959838549 -2.247273386 1.989395830 [241] 18.404432687 29.900865002 4.587470363 22.903142819 6.269894907 [246] -4.325772517 -5.202771660 -16.853832974 2.663942336 -7.532319536 [251] -5.726393946 0.993761859 7.762615342 -11.984045527 -5.725886920 [256] -7.000232463 1.224749163 -6.522639470 -4.992506902 -8.763215537 [261] 2.188022446 -3.523502153 0.308185951 -0.828242505 4.348257908 [266] -4.103495048 3.140533455 -8.964634943 2.972078590 0.780206794 [271] -3.413240560 10.310082605 -18.053680496 6.550312667 18.862604478 [276] 5.502554349 -10.582916929 -2.218435572 -4.498108479 -7.639746836 [281] 7.511489688 0.383242911 -10.808034685 1.860230575 -6.931674674 [286] -0.824317953 2.662410601 -1.232033247 -1.839655883 -7.382725371 [291] -0.463128609 6.950789915 -8.320459445 -2.634799176 -0.022298352 [296] -0.789278017 -2.548949302 -5.815244164 4.985406078 -0.441790731 [301] -9.316361038 15.338008287 -1.754436230 -9.470686045 7.233475242 [306] -6.381461504 0.478046791 -3.510293938 3.412581160 -5.481671378 [311] 18.334150640 -14.827517905 4.041768142 6.675931965 -10.223871591 [316] 2.048251316 2.997740747 -3.528102103 0.865963149 -8.643189868 [321] -1.207923463 11.517167679 -2.296765981 -4.534170662 9.124513536 [326] -6.497336996 -7.083347294 -3.941921728 16.422543385 -5.806262683 [331] 0.280068959 -3.443379720 -5.432296596 1.731562591 28.531068748 [336] -22.596609829 11.534281884 19.839472623 -1.551924491 4.868922955 [341] -9.484611759 17.337905362 -9.223588220 3.566617066 -14.603603456 [346] 1.576587588 1.451235416 -4.347121012 14.871804378 -6.341280030 [351] 4.707568053 -22.061149300 7.756497580 3.852378904 -2.963047412 [356] -2.595105815 4.009617082 -7.066015165 > postscript(file="/var/www/html/rcomp/tmp/2lwy41260473170.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/3191d1260473170.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/4zxnr1260473170.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/524k61260473170.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/6hsly1260473170.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/75mvw1260473170.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/8iaar1260473170.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/914r81260473170.tab") > > system("convert tmp/1rsb91260473170.ps tmp/1rsb91260473170.png") > system("convert tmp/2lwy41260473170.ps tmp/2lwy41260473170.png") > system("convert tmp/3191d1260473170.ps tmp/3191d1260473170.png") > system("convert tmp/4zxnr1260473170.ps tmp/4zxnr1260473170.png") > system("convert tmp/524k61260473170.ps tmp/524k61260473170.png") > system("convert tmp/6hsly1260473170.ps tmp/6hsly1260473170.png") > system("convert tmp/75mvw1260473170.ps tmp/75mvw1260473170.png") > > > proc.time() user system elapsed 4.241 1.113 5.375