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.90 + ,339.20 + ,374.20 + ,393.50 + ,389.20 + ,381.70 + ,375.20 + ,369.00 + ,357.40 + ,352.10 + ,346.50 + ,342.90 + ,340.30 + ,328.30 + ,322.90 + ,314.30 + ,308.90 + ,294.00 + ,285.60 + ,281.20 + ,280.30 + ,278.80 + ,274.50 + ,270.40 + ,263.40 + ,259.90 + ,258.00 + ,262.70 + ,284.70 + ,311.30 + ,322.10 + ,327.00 + ,331.30 + ,333.30 + ,321.40 + ,327.00 + ,320.00 + ,314.70 + ,316.70 + ,314.40 + ,321.30 + ,318.20 + ,307.20 + ,301.30 + ,287.50 + ,277.70 + ,274.40 + ,258.80 + ,253.30 + ,251.00 + ,248.40 + ,249.50 + ,246.10 + ,244.50 + ,243.60 + ,244.00 + ,240.80 + ,249.80 + ,248.00 + ,259.40 + ,260.50 + ,260.80 + ,261.30 + ,259.50 + ,256.60 + ,257.90 + ,256.50 + ,254.20 + ,253.30 + ,253.80 + ,255.50 + ,257.10 + ,257.30 + ,253.20 + ,252.80 + ,252.00 + ,250.70 + ,252.20 + ,250.00 + ,251.00 + ,253.40 + ,251.20 + ,255.60 + ,261.10 + ,258.90 + ,259.90 + ,261.20 + ,264.70 + ,267.10 + ,266.40 + ,267.70 + ,268.60 + ,267.50 + ,268.50 + ,268.50 + ,270.50 + ,270.90 + ,270.10 + ,269.30 + ,269.80 + ,270.10 + ,264.90 + ,263.70 + ,264.80 + ,263.70 + ,255.90 + ,276.20 + ,360.10 + ,380.50 + ,373.70 + ,369.80 + ,366.60 + ,359.30 + ,345.80 + ,326.20 + ,324.50 + ,328.10 + ,327.50 + ,324.40 + ,316.50 + ,310.90 + ,301.50 + ,291.70 + ,290.40 + ,287.40 + ,277.70 + ,281.60 + ,288.00 + ,276.00 + ,272.90 + ,283.00 + ,283.30 + ,276.80 + ,284.50 + ,282.70 + ,281.20 + ,287.40 + ,283.10 + ,284.00 + ,285.50 + ,289.20 + ,292.50 + ,296.40 + ,305.20 + ,303.90 + ,311.50 + ,316.30 + ,316.70 + ,322.50 + ,317.10 + ,309.80 + ,303.80 + ,290.30 + ,293.70 + ,291.70 + ,296.50 + ,289.10 + ,288.50 + ,293.80 + ,297.70 + ,305.40 + ,302.70 + ,302.50 + ,303.00 + ,294.50 + ,294.10 + ,294.50 + ,297.10 + ,289.40 + ,292.40 + ,287.90 + ,286.60 + ,280.50 + ,272.40 + ,269.20 + ,270.60 + ,267.30 + ,262.50 + ,266.80 + ,268.80 + ,263.10 + ,261.20 + ,266.00 + ,262.50 + ,265.20 + ,261.30 + ,253.70 + ,249.20 + ,239.10 + ,236.40 + ,235.20 + ,245.20 + ,246.20 + ,247.70 + ,251.40 + ,253.30 + ,254.80 + ,250.00 + ,249.30 + ,241.50 + ,243.30 + ,248.00 + ,253.00 + ,252.90 + ,251.50 + ,251.60 + ,253.50 + ,259.80 + ,334.10 + ,448.00 + ,445.80 + ,445.00 + ,448.20 + ,438.20 + ,439.80 + ,423.40 + ,410.80 + ,408.40 + ,406.70 + ,405.90 + ,402.70 + ,405.10 + ,399.60 + ,386.50 + ,381.40 + ,375.20 + ,357.70 + ,359.00 + ,355.00 + ,352.70 + ,344.40 + ,343.80 + ,338.00 + ,339.00 + ,333.30 + ,334.40 + ,328.30 + ,330.70 + ,330.00 + ,331.60 + ,351.20 + ,389.40 + ,410.90 + ,442.80 + ,462.80 + ,466.90 + ,461.70 + ,439.20 + ,430.30 + ,416.10 + ,402.50 + ,397.30 + ,403.30 + ,395.90 + ,387.80 + ,378.60 + ,377.10 + ,370.40 + ,362.00 + ,350.30 + ,348.20 + ,344.60 + ,343.50 + ,342.80 + ,347.60 + ,346.60 + ,349.50 + ,342.10 + ,342.00 + ,342.80 + ,339.30 + ,348.20 + ,333.70 + ,334.70 + ,354.00 + ,367.70 + ,363.30 + ,358.40 + ,353.10 + ,343.10 + ,344.60 + ,344.40 + ,333.90 + ,331.70 + ,324.30 + ,321.20 + ,322.40 + ,321.70 + ,320.50 + ,312.80 + ,309.70 + ,315.60 + ,309.70 + ,304.60 + ,302.50 + ,301.50 + ,298.80 + ,291.30 + ,293.60 + ,294.60 + ,285.90 + ,297.60 + ,301.10 + ,293.80 + ,297.70 + ,292.90 + ,292.10 + ,287.20 + ,288.20 + ,283.80 + ,299.90 + ,292.40 + ,293.30 + ,300.80 + ,293.70 + ,293.10 + ,294.40 + ,292.10 + ,291.90 + ,282.50 + ,277.90 + ,287.50 + ,289.20 + ,285.60 + ,293.20 + ,290.80 + ,283.10 + ,275.00 + ,287.80 + ,287.80 + ,287.40 + ,284.00 + ,277.80 + ,277.60 + ,304.90 + ,294.00 + ,300.90 + ,324.00 + ,332.90 + ,341.60 + ,333.40 + ,348.20 + ,344.70 + ,344.70 + ,329.30 + ,323.50 + ,323.20 + ,317.40 + ,330.10 + ,329.20 + ,334.90 + ,315.80 + ,315.40 + ,319.60 + ,317.30 + ,313.80 + ,315.80 + ,311.30) > 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/1wkm31260301717.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/219l81260301717.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/3ikyb1260301717.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/4ti781260301717.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/5b93r1260301717.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/6h4tj1260301717.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/7ay9x1260301717.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/8cl881260301717.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/940rv1260301717.tab") > > system("convert tmp/1wkm31260301717.ps tmp/1wkm31260301717.png") > system("convert tmp/219l81260301717.ps tmp/219l81260301717.png") > system("convert tmp/3ikyb1260301717.ps tmp/3ikyb1260301717.png") > system("convert tmp/4ti781260301717.ps tmp/4ti781260301717.png") > system("convert tmp/5b93r1260301717.ps tmp/5b93r1260301717.png") > system("convert tmp/6h4tj1260301717.ps tmp/6h4tj1260301717.png") > system("convert tmp/7ay9x1260301717.ps tmp/7ay9x1260301717.png") > > > proc.time() user system elapsed 4.151 1.114 6.375