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(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 = '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.4698247 -0.11095275 0.11078830 -0.07794260 0.009061385 -0.08887166 [2,] 0.4697854 -0.11114920 0.11091437 -0.07814738 0.009433210 -0.08926963 [3,] 0.4695399 -0.11099684 0.11092332 -0.07821822 0.009105257 -0.08925761 [4,] 0.4689523 -0.10994768 0.10967210 -0.07439202 0.000000000 -0.08555259 [5,] 0.4704072 -0.11007697 0.11047371 -0.07569223 0.000000000 -0.09196853 [6,] 0.4702518 -0.11210778 0.10839091 -0.07504720 0.000000000 -0.08873151 [7,] 0.4699514 -0.11168597 0.11096291 -0.07153690 0.000000000 -0.08937834 [8,] 0.4648193 -0.10402028 0.08001677 0.00000000 0.000000000 -0.09493819 [9,] 0.4595119 -0.06920824 0.00000000 0.00000000 0.000000000 -0.08829840 [10,] 0.4302183 0.00000000 0.00000000 0.00000000 0.000000000 -0.08969729 [11,] 0.4351177 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.01651007 0.002833205 0.03659209 -0.05986002 0.004041977 [2,] -0.01530580 0.000000000 0.03776619 -0.06025487 0.004341914 [3,] -0.01543703 0.000000000 0.03745901 -0.05833850 0.000000000 [4,] -0.01627055 0.000000000 0.03737720 -0.05833186 0.000000000 [5,] 0.00000000 0.000000000 0.03670300 -0.05958731 0.000000000 [6,] 0.00000000 0.000000000 0.00000000 -0.04462604 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.05928 0.06102 0.18897 0.87885 0.13377 0.78250 0.96221 0.53822 [2,] 0 0.05817 0.06049 0.18670 0.87282 0.12802 0.77740 NA 0.48323 [3,] 0 0.05838 0.06046 0.18626 0.87692 0.12807 0.77544 NA 0.48571 [4,] 0 0.05910 0.06092 0.16660 NA 0.10991 0.76255 NA 0.48663 [5,] 0 0.05882 0.05884 0.15809 NA 0.06127 NA NA 0.49422 [6,] 0 0.05418 0.06357 0.16201 NA 0.06980 NA NA NA [7,] 0 0.05539 0.05758 0.18186 NA 0.06812 NA NA NA [8,] 0 0.07348 0.13630 NA NA 0.05248 NA NA NA [9,] 0 0.19428 NA NA NA 0.07089 NA NA NA [10,] 0 NA NA NA NA 0.06713 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.31328 0.94044 [2,] 0.30463 0.93556 [3,] 0.27683 NA [4,] 0.27689 NA [5,] 0.26534 NA [6,] 0.36081 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.4698 -0.1110 0.1108 -0.0779 0.0091 -0.0889 -0.0165 0.0028 s.e. 0.0528 0.0586 0.0589 0.0592 0.0594 0.0591 0.0598 0.0598 ar9 ar10 ar11 0.0366 -0.0599 0.0040 s.e. 0.0594 0.0593 0.0541 sigma^2 estimated as 108.9: log likelihood = -1347.8, aic = 2719.61 [[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.4698 -0.1110 0.1108 -0.0779 0.0091 -0.0889 -0.0165 0.0028 s.e. 0.0528 0.0586 0.0589 0.0592 0.0594 0.0591 0.0598 0.0598 ar9 ar10 ar11 0.0366 -0.0599 0.0040 s.e. 0.0594 0.0593 0.0541 sigma^2 estimated as 108.9: log likelihood = -1347.8, aic = 2719.61 [[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.4698 -0.1111 0.1109 -0.0781 0.0094 -0.0893 -0.0153 0 0.0378 s.e. 0.0528 0.0585 0.0589 0.0591 0.0589 0.0585 0.0541 0 0.0538 ar10 ar11 -0.0603 0.0043 s.e. 0.0586 0.0537 sigma^2 estimated as 108.9: log likelihood = -1347.81, aic = 2717.61 [[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.4695 -0.1110 0.1109 -0.0782 0.0091 -0.0893 -0.0154 0 0.0375 s.e. 0.0527 0.0584 0.0589 0.0591 0.0587 0.0585 0.0541 0 0.0537 ar10 ar11 -0.0583 0 s.e. 0.0536 0 sigma^2 estimated as 108.9: log likelihood = -1347.81, aic = 2715.62 [[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.4690 -0.1099 0.1097 -0.0744 0 -0.0856 -0.0163 0 0.0374 s.e. 0.0526 0.0581 0.0583 0.0537 0 0.0534 0.0538 0 0.0537 ar10 ar11 -0.0583 0 s.e. 0.0536 0 sigma^2 estimated as 108.9: log likelihood = -1347.82, aic = 2713.64 [[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.4704 -0.1101 0.1105 -0.0757 0 -0.092 0 0 0.0367 -0.0596 s.e. 0.0524 0.0581 0.0583 0.0535 0 0.049 0 0 0.0536 0.0534 ar11 0 s.e. 0 sigma^2 estimated as 109.0: log likelihood = -1347.87, aic = 2711.73 [[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.4703 -0.1121 0.1084 -0.0750 0 -0.0887 0 0 0 -0.0446 s.e. 0.0524 0.0580 0.0582 0.0536 0 0.0488 0 0 0 0.0488 ar11 0 s.e. 0 sigma^2 estimated as 109.1: log likelihood = -1348.1, aic = 2710.2 [[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.4700 -0.1117 0.1110 -0.0715 0 -0.0894 0 0 0 0 0 s.e. 0.0525 0.0581 0.0582 0.0535 0 0.0488 0 0 0 0 0 sigma^2 estimated as 109.4: log likelihood = -1348.52, aic = 2709.04 [[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.4648 -0.1040 0.0800 0 0 -0.0949 0 0 0 0 0 s.e. 0.0525 0.0579 0.0536 0 0 0.0488 0 0 0 0 0 sigma^2 estimated as 109.9: log likelihood = -1349.41, aic = 2708.82 [[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.4595 -0.0692 0 0 0 -0.0883 0 0 0 0 0 s.e. 0.0525 0.0532 0 0 0 0.0487 0 0 0 0 0 sigma^2 estimated as 110.6: log likelihood = -1350.52, aic = 2709.04 [[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.4302 0 0 0 0 -0.0897 0 0 0 0 0 s.e. 0.0476 0 0 0 0 0.0488 0 0 0 0 0 sigma^2 estimated as 111.2: log likelihood = -1351.37, aic = 2708.73 $aic [1] 2719.608 2717.610 2715.617 2713.641 2711.732 2710.200 2709.036 2708.821 [9] 2709.043 2708.731 2710.085 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/1ebqu1260475458.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 = 359 Frequency = 1 [1] 0.280199826 17.668037995 30.614752422 17.897400591 4.216640224 [6] -12.291254362 -4.849029322 -1.506325900 0.121522562 -5.793241270 [11] 1.421690389 -3.705541115 -1.863506927 -1.634246326 -11.437555483 [16] -1.277868409 -6.752216567 -2.202427057 -12.899731181 -2.222959643 [21] -1.862533356 0.508595362 -1.884200151 -4.139037831 -3.586550688 [26] -5.989561998 -0.883139662 -0.474963359 5.382868922 19.592275462 [31] 16.767437597 -1.271688907 -0.060298598 2.021505279 0.571638372 [36] -10.787096394 13.105546079 -8.440492029 -1.848954903 4.665855544 [41] -2.981042113 6.822104485 -5.566201761 -10.294204140 -1.642993850 [46] -11.082317208 -4.069290634 1.535051028 -14.458341057 0.224735995 [51] -0.463013104 -2.848320359 1.339534288 -4.169241220 -1.536535297 [56] -0.704985725 0.580892750 -3.605300280 10.475365710 -5.976935853 [61] 12.030877359 -3.885216660 -0.137361262 0.083903182 -1.207833598 [66] -2.287062098 3.570182252 -1.860616830 -1.670785135 0.134350830 [71] 0.725741393 1.224768700 0.985235290 -0.613925548 -4.392347426 [76] 1.283167646 -0.583064020 -0.803339940 2.202799503 -2.827388056 [81] 1.578721481 1.933902743 -3.304281850 5.229873881 3.741585223 [86] -4.763534912 2.036177639 1.085055144 2.743382126 1.288903860 [91] -1.239188949 1.403818811 0.430413441 -1.370590036 1.787180677 [96] -0.214944856 1.937211900 -0.343830213 -0.891359780 -0.554492341 [101] 0.933871960 0.084890829 -5.149670931 1.073014294 1.544504182 [106] -1.644998005 -7.281911180 23.682612256 74.700141764 -15.802955664 [111] -15.477787169 -1.073182287 -2.221787295 -4.102446400 -2.833803811 [116] -11.962227746 6.122337965 3.981551767 -2.435817347 -3.496659182 [121] -7.777236499 -3.959341900 -7.143262669 -5.433037353 2.862321383 [126] -2.718777741 -9.117953532 7.570813119 3.878993977 -15.632430793 [131] 1.946013636 11.164585003 -4.915268931 -6.279246088 11.070481855 [136] -6.189048667 -1.003668570 7.751270101 -6.940444537 2.166906513 [141] 1.803472594 2.893217372 1.573646205 3.036402643 6.736450135 [146] -5.005193855 8.293829774 1.862220556 -1.369047000 5.977732078 [151] -7.105930269 -5.093427423 -2.177706728 -10.488142974 9.243826536 [156] -2.942498105 5.176071341 -10.119838230 2.045432018 4.347217645 [161] 1.924813558 5.842753893 -5.582134263 0.297829608 0.532225297 [166] -8.239713556 3.606675325 1.262756439 2.185729991 -8.836507147 [171] 6.357529879 -6.553081957 0.600103626 -5.504837241 -5.242455168 [176] -0.405900529 3.045790553 -4.305943466 -3.496885942 5.817894599 [181] -0.576486888 -6.847468000 0.677820752 5.321413807 -5.995595016 [186] 4.591462528 -4.882194952 -6.433422995 -1.400765442 -7.733470487 [191] 1.331264757 0.203772196 10.166442596 -3.983882796 0.666143871 [196] 2.148729899 0.066009461 0.574948406 -4.548354654 1.454745329 [201] -7.364301231 5.487583028 4.096031827 3.112519720 -2.681638684 [206] -1.419766266 0.002666849 2.018433280 5.904162393 72.038110873 [211] 81.925807437 -51.327445391 0.155450082 3.714599517 -10.811605794 [216] 12.566691768 -6.871828480 -5.741753215 2.948993285 -0.380444663 [221] -0.965601677 -2.712309669 2.305663206 -7.662709824 -10.949072603 [226] 0.383374898 -4.077644283 -15.119677593 9.044094477 -5.052618918 [231] -1.754161076 -7.767953971 2.414689068 -7.111571498 3.611872857 [236] -6.489007486 3.345940794 -7.317727650 4.970513517 -2.252768280 [241] 1.990850126 18.400376122 29.866387505 4.518505879 22.865579126 [246] 6.213246780 -4.360851189 -5.205828399 -16.836428297 2.708404350 [251] -7.509713332 -5.696953820 1.018728328 7.770709493 -11.999498987 [256] -5.714690112 -6.988932887 1.238125661 -6.521098373 -4.979353391 [261] -8.749925840 2.207006589 -3.521756512 0.314240103 -0.827731639 [266] 4.347695638 -4.114506289 3.141854042 -8.970543422 2.984948719 [271] 0.780233734 -3.413627701 10.316066912 -18.068821117 6.574406048 [276] 18.860811929 5.468543822 -10.607931791 -2.208733449 -4.492540769 [281] -7.630145500 7.533341042 0.383525304 -10.808624390 1.877775893 [286] -6.928915262 -0.813357126 2.668222790 -1.234201468 -1.840668663 [291] -7.381072018 -0.451078680 6.955615275 -8.330651477 -2.624499880 [296] -0.013523197 -0.787210583 -2.547843244 -5.809196489 4.997423580 [301] -0.446958346 -9.318582643 15.353202292 -1.775737277 -9.478493843 [306] 7.246897657 -6.388154249 0.484681656 -3.506367081 3.422010378 [311] -5.485008530 18.342780121 -14.857062284 4.054879739 6.673286791 [316] -10.236940281 2.059882172 3.002257309 -3.532013490 0.870229745 [321] -8.641226687 -1.192798312 11.525186003 -2.313489615 -4.537674940 [326] 9.130846575 -6.512813889 -7.080083494 -3.926224819 16.437253959 [331] -5.829705011 0.281699373 -3.443186149 -5.427926738 1.740805706 [336] 28.534168928 -22.644960745 11.553501017 19.826522666 -1.594166880 [341] 4.853117296 -9.494163672 17.350089990 -9.248320193 3.577771503 [346] -14.601694155 1.605728859 1.459748641 -4.343414666 14.881325885 [351] -6.363772947 4.705858305 -22.072488810 7.790261153 3.851843079 [356] -2.967761506 -2.591225370 4.017038728 -7.073654846 > postscript(file="/var/www/html/rcomp/tmp/24zr21260475458.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/3q3ku1260475458.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/42fmj1260475458.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/525cy1260475458.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/6l7gh1260475458.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/73rh81260475458.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/8hucf1260475458.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/9rmfp1260475458.tab") > > system("convert tmp/1ebqu1260475458.ps tmp/1ebqu1260475458.png") > system("convert tmp/24zr21260475458.ps tmp/24zr21260475458.png") > system("convert tmp/3q3ku1260475458.ps tmp/3q3ku1260475458.png") > system("convert tmp/42fmj1260475458.ps tmp/42fmj1260475458.png") > system("convert tmp/525cy1260475458.ps tmp/525cy1260475458.png") > system("convert tmp/6l7gh1260475458.ps tmp/6l7gh1260475458.png") > system("convert tmp/73rh81260475458.ps tmp/73rh81260475458.png") > > > proc.time() user system elapsed 4.339 1.139 5.090