R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- c(255 + ,280.2 + ,299.9 + ,339.2 + ,374.2 + ,393.5 + ,389.2 + ,381.7 + ,375.2 + ,369 + ,357.4 + ,352.1 + ,346.5 + ,342.9 + ,340.3 + ,328.3 + ,322.9 + ,314.3 + ,308.9 + ,294 + ,285.6 + ,281.2 + ,280.3 + ,278.8 + ,274.5 + ,270.4 + ,263.4 + ,259.9 + ,258 + ,262.7 + ,284.7 + ,311.3 + ,322.1 + ,327 + ,331.3 + ,333.3 + ,321.4 + ,327 + ,320 + ,314.7 + ,316.7 + ,314.4 + ,321.3 + ,318.2 + ,307.2 + ,301.3 + ,287.5 + ,277.7 + ,274.4 + ,258.8 + ,253.3 + ,251 + ,248.4 + ,249.5 + ,246.1 + ,244.5 + ,243.6 + ,244 + ,240.8 + ,249.8 + ,248 + ,259.4 + ,260.5 + ,260.8 + ,261.3 + ,259.5 + ,256.6 + ,257.9 + ,256.5 + ,254.2 + ,253.3 + ,253.8 + ,255.5 + ,257.1 + ,257.3 + ,253.2 + ,252.8 + ,252 + ,250.7 + ,252.2 + ,250 + ,251 + ,253.4 + ,251.2 + ,255.6 + ,261.1 + ,258.9 + ,259.9 + ,261.2 + ,264.7 + ,267.1 + ,266.4 + ,267.7 + ,268.6 + ,267.5 + ,268.5 + ,268.5 + ,270.5 + ,270.9 + ,270.1 + ,269.3 + ,269.8 + ,270.1 + ,264.9 + ,263.7 + ,264.8 + ,263.7 + ,255.9 + ,276.2 + ,360.1 + ,380.5 + ,373.7 + ,369.8 + ,366.6 + ,359.3 + ,345.8 + ,326.2 + ,324.5 + ,328.1 + ,327.5 + ,324.4 + ,316.5 + ,310.9 + ,301.5 + ,291.7 + ,290.4 + ,287.4 + ,277.7 + ,281.6 + ,288 + ,276 + ,272.9 + ,283 + ,283.3 + ,276.8 + ,284.5 + ,282.7 + ,281.2 + ,287.4 + ,283.1 + ,284 + ,285.5 + ,289.2 + ,292.5 + ,296.4 + ,305.2 + ,303.9 + ,311.5 + ,316.3 + ,316.7 + ,322.5 + ,317.1 + ,309.8 + ,303.8 + ,290.3 + ,293.7 + ,291.7 + ,296.5 + ,289.1 + ,288.5 + ,293.8 + ,297.7 + ,305.4 + ,302.7 + ,302.5 + ,303 + ,294.5 + ,294.1 + ,294.5 + ,297.1 + ,289.4 + ,292.4 + ,287.9 + ,286.6 + ,280.5 + ,272.4 + ,269.2 + ,270.6 + ,267.3 + ,262.5 + ,266.8 + ,268.8 + ,263.1 + ,261.2 + ,266 + ,262.5 + ,265.2 + ,261.3 + ,253.7 + ,249.2 + ,239.1 + ,236.4 + ,235.2 + ,245.2 + ,246.2 + ,247.7 + ,251.4 + ,253.3 + ,254.8 + ,250 + ,249.3 + ,241.5 + ,243.3 + ,248 + ,253 + ,252.9 + ,251.5 + ,251.6 + ,253.5 + ,259.8 + ,334.1 + ,448 + ,445.8 + ,445 + ,448.2 + ,438.2 + ,439.8 + ,423.4 + ,410.8 + ,408.4 + ,406.7 + ,405.9 + ,402.7 + ,405.1 + ,399.6 + ,386.5 + ,381.4 + ,375.2 + ,357.7 + ,359 + ,355 + ,352.7 + ,344.4 + ,343.8 + ,338 + ,339 + ,333.3 + ,334.4 + ,328.3 + ,330.7 + ,330 + ,331.6 + ,351.2 + ,389.4 + ,410.9 + ,442.8 + ,462.8 + ,466.9 + ,461.7 + ,439.2 + ,430.3 + ,416.1 + ,402.5 + ,397.3 + ,403.3 + ,395.9 + ,387.8 + ,378.6 + ,377.1 + ,370.4 + ,362 + ,350.3 + ,348.2 + ,344.6 + ,343.5 + ,342.8 + ,347.6 + ,346.6 + ,349.5 + ,342.1 + ,342 + ,342.8 + ,339.3 + ,348.2 + ,333.7 + ,334.7 + ,354 + ,367.7 + ,363.3 + ,358.4 + ,353.1 + ,343.1 + ,344.6 + ,344.4 + ,333.9 + ,331.7 + ,324.3 + ,321.2 + ,322.4 + ,321.7 + ,320.5 + ,312.8 + ,309.7 + ,315.6 + ,309.7 + ,304.6 + ,302.5 + ,301.5 + ,298.8 + ,291.3 + ,293.6 + ,294.6 + ,285.9 + ,297.6 + ,301.1 + ,293.8 + ,297.7 + ,292.9 + ,292.1 + ,287.2 + ,288.2 + ,283.8 + ,299.9 + ,292.4 + ,293.3 + ,300.8 + ,293.7 + ,293.1 + ,294.4 + ,292.1 + ,291.9 + ,282.5 + ,277.9 + ,287.5 + ,289.2 + ,285.6 + ,293.2 + ,290.8 + ,283.1 + ,275 + ,287.8 + ,287.8 + ,287.4 + ,284 + ,277.8 + ,277.6 + ,304.9 + ,294 + ,300.9 + ,324 + ,332.9 + ,341.6 + ,333.4 + ,348.2 + ,344.7 + ,344.7 + ,329.3 + ,323.5 + ,323.2 + ,317.4 + ,330.1 + ,329.2 + ,334.9 + ,315.8 + ,315.4 + ,319.6 + ,317.3 + ,313.8 + ,315.8 + ,311.3) > par9 = '0' > par8 = '0' > par7 = '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.4706161 -0.10055724 0.11708202 -0.07268103 0.004200362 -0.08990264 [2,] 0.4705057 -0.10045990 0.11704653 -0.07268229 0.004039719 -0.08986943 [3,] 0.4702738 -0.10000696 0.11648196 -0.07099703 0.000000000 -0.08815376 [4,] 0.4701346 -0.10028591 0.11663820 -0.07110217 0.000000000 -0.08867409 [5,] 0.4716333 -0.10041228 0.11746687 -0.07243862 0.000000000 -0.09526618 [6,] 0.4714687 -0.10242004 0.11543475 -0.07185876 0.000000000 -0.09217025 [7,] 0.4711768 -0.10195467 0.11806708 -0.06829741 0.000000000 -0.09285742 [8,] 0.4662285 -0.09492129 0.08826620 0.00000000 0.000000000 -0.09808064 [9,] 0.4296833 0.00000000 0.05170177 0.00000000 0.000000000 -0.09643665 [10,] 0.4364471 0.00000000 0.00000000 0.00000000 0.000000000 -0.09187662 [11,] 0.4417024 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.01824108 0.004759368 0.03347612 -0.05826233 0.001800616 [2,] -0.01839944 0.005006346 0.03323214 -0.05742383 0.000000000 [3,] -0.01897438 0.005492572 0.03299746 -0.05738074 0.000000000 [4,] -0.01671348 0.000000000 0.03527662 -0.05793970 0.000000000 [5,] 0.00000000 0.000000000 0.03458154 -0.05922210 0.000000000 [6,] 0.00000000 0.000000000 0.00000000 -0.04511545 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.08605 0.04781 0.22085 0.94372 0.13015 0.76084 0.93669 0.57399 [2,] 0 0.08611 0.04788 0.22079 0.94568 0.13018 0.75809 0.93292 0.57431 [3,] 0 0.08535 0.04659 0.18752 NA 0.10182 0.74839 0.92588 0.57628 [4,] 0 0.08405 0.04621 0.18679 NA 0.09809 0.75681 NA 0.51224 [5,] 0 0.08368 0.04450 0.17736 NA 0.05289 NA NA 0.52029 [6,] 0 0.07746 0.04810 0.18118 NA 0.05995 NA NA NA [7,] 0 0.07918 0.04326 0.20306 NA 0.05838 NA NA NA [8,] 0 0.10118 0.09942 NA NA 0.04538 NA NA NA [9,] 0 NA 0.28976 NA NA 0.04990 NA NA NA [10,] 0 NA NA NA NA 0.06109 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.32735 0.9735 [2,] 0.28836 NA [3,] 0.28866 NA [4,] 0.28116 NA [5,] 0.26930 NA [6,] 0.35650 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.4706 -0.1006 0.1171 -0.0727 0.0042 -0.0899 -0.0182 0.0048 s.e. 0.0529 0.0584 0.0590 0.0593 0.0595 0.0593 0.0599 0.0599 ar9 ar10 ar11 0.0335 -0.0583 0.0018 s.e. 0.0595 0.0594 0.0542 sigma^2 estimated as 109.4: log likelihood = -1352.38, aic = 2728.76 [[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.4706 -0.1006 0.1171 -0.0727 0.0042 -0.0899 -0.0182 0.0048 s.e. 0.0529 0.0584 0.0590 0.0593 0.0595 0.0593 0.0599 0.0599 ar9 ar10 ar11 0.0335 -0.0583 0.0018 s.e. 0.0595 0.0594 0.0542 sigma^2 estimated as 109.4: log likelihood = -1352.38, aic = 2728.76 [[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.4705 -0.1005 0.117 -0.0727 0.0040 -0.0899 -0.0184 0.0050 0.0332 s.e. 0.0528 0.0584 0.059 0.0593 0.0593 0.0592 0.0597 0.0594 0.0591 ar10 ar11 -0.0574 0 s.e. 0.0540 0 sigma^2 estimated as 109.4: log likelihood = -1352.38, aic = 2726.77 [[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.4703 -0.100 0.1165 -0.0710 0 -0.0882 -0.0190 0.0055 0.033 s.e. 0.0527 0.058 0.0583 0.0538 0 0.0537 0.0591 0.0590 0.059 ar10 ar11 -0.0574 0 s.e. 0.0540 0 sigma^2 estimated as 109.4: log likelihood = -1352.39, aic = 2724.77 [[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.4701 -0.1003 0.1166 -0.0711 0 -0.0887 -0.0167 0 0.0353 s.e. 0.0527 0.0579 0.0583 0.0538 0 0.0535 0.0539 0 0.0538 ar10 ar11 -0.0579 0 s.e. 0.0537 0 sigma^2 estimated as 109.4: log likelihood = -1352.39, aic = 2722.78 [[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.4716 -0.1004 0.1175 -0.0724 0 -0.0953 0 0 0.0346 -0.0592 s.e. 0.0525 0.0579 0.0583 0.0536 0 0.0490 0 0 0.0537 0.0535 ar11 0 s.e. 0 sigma^2 estimated as 109.5: log likelihood = -1352.44, aic = 2720.88 [[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.4715 -0.1024 0.1154 -0.0719 0 -0.0922 0 0 0 -0.0451 s.e. 0.0525 0.0578 0.0582 0.0536 0 0.0488 0 0 0 0.0489 ar11 0 s.e. 0 sigma^2 estimated as 109.6: log likelihood = -1352.64, aic = 2719.29 [[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.4712 -0.1020 0.1181 -0.0683 0 -0.0929 0 0 0 0 0 s.e. 0.0526 0.0579 0.0582 0.0536 0 0.0489 0 0 0 0 0 sigma^2 estimated as 109.9: log likelihood = -1353.07, aic = 2718.14 [[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.4662 -0.0949 0.0883 0 0 -0.0981 0 0 0 0 0 s.e. 0.0526 0.0578 0.0534 0 0 0.0488 0 0 0 0 0 sigma^2 estimated as 110.4: log likelihood = -1353.88, aic = 2717.76 [[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.4297 0 0.0517 0 0 -0.0964 0 0 0 0 0 s.e. 0.0478 0 0.0488 0 0 0.0490 0 0 0 0 0 sigma^2 estimated as 111.2: log likelihood = -1355.23, aic = 2718.45 [[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.4364 0 0 0 0 -0.0919 0 0 0 0 0 s.e. 0.0475 0 0 0 0 0.0489 0 0 0 0 0 sigma^2 estimated as 111.6: log likelihood = -1355.79, aic = 2717.58 $aic [1] 2728.765 2726.766 2724.771 2722.779 2720.875 2719.289 2718.140 2717.763 [9] 2718.453 2717.575 2719.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/1hl8y1260442644.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > resid <- arimaSelectplot(selection) > dev.off() null device 1 > resid Time Series: Start = 1 End = 360 Frequency = 1 [1] 0.254999840 22.516670285 8.578742148 30.538040062 17.772974043 [6] 4.296603285 -11.726204804 -3.307986523 -1.416677086 0.247657500 [11] -5.678346101 1.536005528 -3.681899633 -1.844970671 -1.625988327 [16] -11.434872479 -1.228403130 -6.730131538 -2.161063685 -12.873941286 [21] -2.135816866 -1.836363471 0.524233663 -1.897336496 -4.141463035 [26] -3.592238927 -5.982330334 -0.849127162 -0.455123977 5.391434633 [31] 19.553628996 16.621468848 -1.452630177 -0.135197246 1.986843453 [36] 0.555097418 -10.751608666 13.237638985 -8.451836487 -1.794674609 [41] 4.708239286 -2.989141037 6.810496654 -5.596976182 -10.290150205 [46] -1.586027570 -11.041208654 -3.988345731 1.611130612 -14.444541965 [51] 0.297932535 -0.441612795 -2.864068921 1.334371695 -4.183284692 [56] -1.549354983 -0.707005983 0.581486201 -3.613458063 10.497695119 [61] -6.040404737 12.038602257 -3.958186320 -0.143341203 0.075060679 [66] -1.191334002 -2.279773067 3.613090149 -1.866316998 -1.661411023 [71] 0.149766725 0.727424510 1.215334238 0.977479471 -0.626942685 [76] -4.398605650 1.306744305 -0.579482836 -0.794652039 2.214383868 [81] -2.836295382 1.583489566 1.926802215 -3.320974424 5.240744097 [86] 3.717447525 -4.802587815 2.052060320 1.084056747 2.730490161 [91] 1.276692142 -1.242151727 1.403384435 0.424495340 -1.373362819 [96] 1.801660016 -0.215943253 1.935686367 -0.353454670 -0.891889898 [101] -0.551906571 0.941034328 0.081776431 -5.147180904 1.106275760 [106] 1.550235270 -1.653593146 -7.273969840 23.731850655 74.562364701 [111] -16.328166744 -15.602457316 -1.033223748 -2.214493790 -4.038273805 [116] -2.605487602 -11.833680631 6.229602881 3.983641321 -2.465214873 [121] -3.508831033 -7.787348226 -3.952849341 -7.112086284 -5.366641085 [126] 2.922055972 -2.717436239 -9.116483875 7.619028166 3.834215951 [131] -15.693652539 2.017926041 11.177356269 -4.999319285 -6.272615329 [136] 11.124916750 -6.263162378 -0.999212671 7.782624553 -6.978409264 [141] 2.179524669 1.814647539 2.879951381 1.547330665 3.029359483 [146] 6.702786706 -5.058045850 8.305196206 1.822945247 -1.391753417 [151] 5.983739958 -7.122879152 -5.062625064 -2.115673598 -10.440309408 [156] 9.328786998 -2.951035878 5.176760534 -10.165645574 2.078449103 [161] 4.321533932 1.899210676 5.814102928 -5.619635187 0.298520293 [166] 0.532163456 -8.231277490 3.668119478 1.282028818 2.177354275 [171] -8.853137880 6.406581265 -6.590292669 0.627261469 -5.495868074 [176] -5.198793255 -0.372228152 3.072260694 -4.324470775 -3.479164052 [181] 5.834498885 -0.620923300 -6.866899454 0.716375947 5.326056719 [186] -6.035954027 4.622634440 -4.894654033 -6.421552891 -1.357567333 [191] -7.694980114 1.386547920 0.226474140 10.165417752 -4.062733672 [196] 0.650108079 2.117375447 0.037078723 0.560498497 -4.535904520 [201] 1.486822877 -7.356672076 5.544231158 4.088960728 3.086513383 [206] -2.723243455 -1.420668919 -0.005611633 2.021733200 5.902570547 [211] 72.009766129 81.462790052 -52.039956181 0.169371363 3.723723285 [216] -10.817808142 12.790904130 -6.633568566 -5.644395512 3.025732633 [221] -0.358521692 -0.976806053 -2.703839701 2.289854294 -7.705118523 [226] -10.920044631 0.461267244 -4.047620896 -15.088032929 9.158328784 [231] -5.072702680 -1.757795155 -7.764742339 2.452876203 -7.145972542 [236] 3.650832999 -6.503953611 3.376432459 -7.342667785 5.007201565 [241] -2.280357517 1.997389615 18.377987855 29.746700393 4.267271990 [246] 22.736890437 6.013022694 -4.481940152 -5.188651538 -16.720788058 [251] 2.895407884 -7.384756348 -5.564918282 1.112375201 7.791766696 [256] -12.085906740 -5.687993091 -6.969426173 1.265791649 -6.523087711 [261] -4.924544470 -8.713731026 2.262230894 -3.528725903 0.333394766 [266] -0.835481494 4.333749400 -4.169902695 3.143506238 -8.996452524 [271] 3.028644534 0.779331081 -3.408149941 10.335688361 -18.117937326 [276] 6.648596511 18.854365201 5.350071549 -10.700893943 -2.161930692 [281] -4.493619997 -7.594953555 7.637690109 0.404038969 -10.816967694 [286] 1.932499509 -6.926762377 -0.789057371 2.690801053 -1.242111888 [291] -1.859191499 -7.378391996 -0.419244022 6.968168607 -8.364786167 [296] -2.589275524 0.015628457 -0.790910975 -2.548370380 -5.779520680 [301] 5.031281479 -0.472399170 -9.329388036 15.405213474 -1.854498374 [306] -9.516639619 7.297380323 -6.410267216 0.495619677 -3.475885853 [311] 3.460159137 -5.507146453 18.378686216 -14.967806676 4.099852233 [316] 6.657002146 -10.281476910 2.094517552 3.041081841 -3.556455917 [321] 0.886517372 -8.623635933 -1.149720903 11.552530859 -2.370452912 [326] -4.553276356 9.152834370 -6.580638456 -7.075159316 -3.857341506 [331] 16.491412062 -5.917279182 0.298262301 -3.445925030 -5.423529697 [336] 1.761771640 28.563310145 -22.815006843 11.620523147 19.776134251 [341] -1.751563902 4.797245156 -9.488858406 17.377411382 -9.325468961 [346] 3.649914868 -14.582298095 1.720612493 1.478005123 -4.309291904 [351] 14.909825230 -6.442878641 4.677902498 -22.120633069 7.908577333 [356] 3.841694467 -2.966244920 -2.578860541 4.051261706 -7.127737689 > postscript(file="/var/www/html/rcomp/tmp/23g561260442644.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/3qcc11260442644.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/4bv9n1260442644.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/526bf1260442644.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/6tp2z1260442644.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/7fpks1260442644.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/8kzxm1260442644.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/9mj461260442645.tab") > > system("convert tmp/1hl8y1260442644.ps tmp/1hl8y1260442644.png") > system("convert tmp/23g561260442644.ps tmp/23g561260442644.png") > system("convert tmp/3qcc11260442644.ps tmp/3qcc11260442644.png") > system("convert tmp/4bv9n1260442644.ps tmp/4bv9n1260442644.png") > system("convert tmp/526bf1260442644.ps tmp/526bf1260442644.png") > system("convert tmp/6tp2z1260442644.ps tmp/6tp2z1260442644.png") > system("convert tmp/7fpks1260442644.ps tmp/7fpks1260442644.png") > > > proc.time() user system elapsed 4.253 1.130 5.503