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(107.11,107.57,107.81,108.75,109.43,109.62,109.54,109.53,109.84,109.67,109.79,109.56,110.22,110.40,110.69,110.72,110.89,110.58,110.94,110.91,111.22,111.09,111.00,111.06,111.55,112.32,112.64,112.36,112.04,112.37,112.59,112.89,113.22,112.85,113.06,112.99,113.32,113.74,113.91,114.52,114.96,114.91,115.30,115.44,115.52,116.08,115.94,115.56,115.88,116.66,117.41,117.68,117.85,118.21,118.92,119.03,119.17,118.95,118.92,118.90) > par9 = '1' > par8 = '0' > par7 = '1' > par6 = '0' > 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.8547890 -0.08579761 -0.3349347 0.2624203 0.05153579 -0.02624997 [2,] 0.8510541 -0.08010898 -0.3380057 0.2605898 0.05206724 -0.02161800 [3,] 0.8498994 -0.08311547 -0.3318069 0.2585329 0.03941474 0.00000000 [4,] 0.8573541 -0.09461671 -0.3352630 0.2930253 0.00000000 0.00000000 [5,] 0.7971262 0.00000000 -0.3890364 0.3041771 0.00000000 0.00000000 [6,] 0.7868499 0.00000000 -0.3576880 0.2728586 0.00000000 0.00000000 [7,] 0.7643040 0.00000000 -0.3307024 0.2638446 0.00000000 0.00000000 [8,] 0.6544216 0.00000000 -0.3110623 0.2244025 0.00000000 0.00000000 [9,] 0.7159364 0.00000000 -0.2876193 0.2350634 0.00000000 0.00000000 [10,] NA NA NA NA NA NA [11,] NA NA NA NA NA NA [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 [23,] NA NA NA NA NA NA [24,] NA NA NA NA NA NA [25,] NA NA NA NA NA NA [26,] NA NA NA NA NA NA [,7] [,8] [,9] [,10] [,11] [,12] [1,] -0.2584286 0.2801656 -0.02028016 -0.08989518 0.3527465 -0.6773317 [2,] -0.2607743 0.2700840 0.00000000 -0.10039279 0.3530439 -0.6768114 [3,] -0.2711018 0.2697167 0.00000000 -0.09735614 0.3517560 -0.6756018 [4,] -0.2508338 0.2585718 0.00000000 -0.09926540 0.3573443 -0.6780376 [5,] -0.2492925 0.2519535 0.00000000 -0.09834335 0.3685522 -0.6601755 [6,] -0.2151409 0.2008616 0.00000000 0.00000000 0.2970592 -0.6635344 [7,] -0.2247291 0.2174987 0.00000000 0.00000000 0.2906971 -0.6529682 [8,] 0.0000000 0.0839620 0.00000000 0.00000000 0.3207826 -0.5438136 [9,] 0.0000000 0.0000000 0.00000000 0.00000000 0.3119872 -0.6187266 [10,] NA NA NA NA NA NA [11,] NA NA NA NA NA NA [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 [23,] NA NA NA NA NA NA [24,] NA NA NA NA NA NA [25,] NA NA NA NA NA NA [26,] NA NA NA NA NA NA [,13] [1,] -0.1232206 [2,] -0.1188161 [3,] -0.1207935 [4,] -0.1277226 [5,] -0.1303436 [6,] -0.1059805 [7,] 0.0000000 [8,] 0.0000000 [9,] 0.0000000 [10,] NA [11,] NA [12,] NA [13,] NA [14,] NA [15,] NA [16,] NA [17,] NA [18,] NA [19,] NA [20,] NA [21,] NA [22,] NA [23,] NA [24,] NA [25,] NA [26,] NA [[2]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 0.00002 0.62110 0.06849 0.13944 0.76635 0.88270 0.13903 0.11024 0.91195 [2,] 0.00002 0.62845 0.06259 0.14041 0.76414 0.90064 0.13252 0.07095 NA [3,] 0.00002 0.61217 0.05646 0.14105 0.78094 NA 0.07440 0.07092 NA [4,] 0.00001 0.55097 0.05316 0.01961 NA NA 0.05822 0.07234 NA [5,] 0.00000 NA 0.00965 0.01435 NA NA 0.05925 0.07839 NA [6,] 0.00000 NA 0.01279 0.01671 NA NA 0.07731 0.09316 NA [7,] 0.00003 NA 0.01700 0.02036 NA NA 0.07214 0.06906 NA [8,] 0.00370 NA 0.02632 0.05637 NA NA NA 0.42901 NA [9,] 0.00015 NA 0.03884 0.04651 NA NA NA NA NA [10,] NA NA NA NA NA NA NA NA NA [11,] NA 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 [23,] NA NA NA NA NA NA NA NA NA [24,] NA NA NA NA NA NA NA NA NA [25,] NA NA NA NA NA NA NA NA NA [26,] NA NA NA NA NA NA NA NA NA [,10] [,11] [,12] [,13] [1,] 0.61795 0.02337 0.00016 0.45231 [2,] 0.51346 0.02313 0.00017 0.45513 [3,] 0.52101 0.02335 0.00017 0.44485 [4,] 0.51228 0.02011 0.00011 0.41139 [5,] 0.51620 0.01526 0.00026 0.41199 [6,] NA 0.00652 0.00045 0.49986 [7,] NA 0.01394 0.00154 NA [8,] NA 0.01173 0.07368 NA [9,] NA 0.00797 0.01074 NA [10,] NA NA NA NA [11,] NA NA NA NA [12,] NA NA NA NA [13,] NA NA NA NA [14,] NA NA NA NA [15,] NA NA NA NA [16,] NA NA NA NA [17,] NA NA NA NA [18,] NA NA NA NA [19,] NA NA NA NA [20,] NA NA NA NA [21,] NA NA NA NA [22,] NA NA NA NA [23,] NA NA NA NA [24,] NA NA NA NA [25,] NA NA NA NA [26,] NA NA 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.8548 -0.0858 -0.3349 0.2624 0.0515 -0.0262 -0.2584 0.2802 s.e. 0.1823 0.1724 0.1795 0.1745 0.1724 0.1769 0.1717 0.1720 ar9 ar10 ar11 ma1 sma1 -0.0203 -0.0899 0.3527 -0.6773 -0.1232 s.e. 0.1824 0.1790 0.1504 0.1643 0.1626 sigma^2 estimated as 0.07395: log likelihood = -9.19, aic = 46.39 [[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.8548 -0.0858 -0.3349 0.2624 0.0515 -0.0262 -0.2584 0.2802 s.e. 0.1823 0.1724 0.1795 0.1745 0.1724 0.1769 0.1717 0.1720 ar9 ar10 ar11 ma1 sma1 -0.0203 -0.0899 0.3527 -0.6773 -0.1232 s.e. 0.1824 0.1790 0.1504 0.1643 0.1626 sigma^2 estimated as 0.07395: log likelihood = -9.19, aic = 46.39 [[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.8511 -0.0801 -0.3380 0.2606 0.0521 -0.0216 -0.2608 0.2701 0 s.e. 0.1801 0.1645 0.1772 0.1738 0.1725 0.1722 0.1704 0.1462 0 ar10 ar11 ma1 sma1 -0.1004 0.3530 -0.6768 -0.1188 s.e. 0.1525 0.1504 0.1654 0.1578 sigma^2 estimated as 0.07397: log likelihood = -9.2, aic = 44.4 [[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.8499 -0.0831 -0.3318 0.2585 0.0394 0 -0.2711 0.2697 0 s.e. 0.1803 0.1629 0.1698 0.1727 0.1409 0 0.1486 0.1460 0 ar10 ar11 ma1 sma1 -0.0974 0.3518 -0.6756 -0.1208 s.e. 0.1506 0.1502 0.1658 0.1568 sigma^2 estimated as 0.07401: log likelihood = -9.21, aic = 42.41 [[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 ar10 0.8574 -0.0946 -0.3353 0.2930 0 0 -0.2508 0.2586 0 -0.0993 s.e. 0.1763 0.1576 0.1692 0.1214 0 0 0.1293 0.1408 0 0.1504 ar11 ma1 sma1 0.3573 -0.6780 -0.1277 s.e. 0.1487 0.1616 0.1542 sigma^2 estimated as 0.07404: log likelihood = -9.25, aic = 40.49 [[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.7971 0 -0.3890 0.3042 0 0 -0.2493 0.2520 0 -0.0983 s.e. 0.1446 0 0.1445 0.1199 0 0 0.1291 0.1402 0 0.1504 ar11 ma1 sma1 0.3686 -0.6602 -0.1303 s.e. 0.1467 0.1679 0.1575 sigma^2 estimated as 0.07446: log likelihood = -9.43, aic = 38.86 [[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.7868 0 -0.3577 0.2729 0 0 -0.2151 0.2009 0 0 s.e. 0.1540 0 0.1386 0.1103 0 0 0.1193 0.1174 0 0 ar11 ma1 sma1 0.2971 -0.6635 -0.106 s.e. 0.1047 0.1770 0.156 sigma^2 estimated as 0.07522: log likelihood = -9.64, aic = 37.28 [[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 0.7643 0 -0.3307 0.2638 0 0 -0.2247 0.2175 0 0 s.e. 0.1659 0 0.1341 0.1103 0 0 0.1224 0.1172 0 0 ar11 ma1 sma1 0.2907 -0.6530 0 s.e. 0.1142 0.1953 0 sigma^2 estimated as 0.07572: log likelihood = -9.87, aic = 35.75 [[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.6544 0 -0.3111 0.2244 0 0 0 0.0840 0 0 0.3208 s.e. 0.2155 0 0.1361 0.1150 0 0 0 0.1053 0 0 0.1229 ma1 sma1 -0.5438 0 s.e. 0.2980 0 sigma^2 estimated as 0.08113: log likelihood = -11.49, aic = 36.97 [[3]][[10]] NULL [[3]][[11]] NULL [[3]][[12]] NULL [[3]][[13]] NULL $aic [1] 46.38550 44.39783 42.41363 40.49211 38.85914 37.28159 35.74794 36.97170 [9] 35.66672 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 log(s2) : NaNs produced 6: In arima(series, order = order, seasonal = seasonal, include.mean = include.mean, : some AR parameters were fixed: setting transform.pars = FALSE 7: In log(s2) : NaNs produced 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/1ra6x1260626475.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 = 60 Frequency = 1 [1] 0.10710990 0.33047868 0.02987218 0.62080068 0.26146030 -0.27716896 [7] -0.19114565 -0.13980424 0.03777531 -0.47913656 -0.07786209 -0.31430272 [13] 0.32062419 -0.09891730 -0.27384332 -0.26856401 -0.17464070 -0.42642826 [19] 0.26836962 -0.15363328 0.11062542 -0.14477097 -0.12433934 -0.05979345 [25] 0.23620092 0.51196069 0.09351674 -0.35161705 -0.12500101 0.29362095 [31] 0.02198975 0.02679804 0.32326639 -0.45156190 0.20440580 -0.19461419 [37] -0.13930497 0.14627907 -0.02285993 0.68213734 0.33478601 -0.23675902 [43] 0.33170106 -0.03483993 -0.05387359 0.50825512 -0.26586707 -0.59656955 [49] 0.22882827 0.47547594 0.18291159 -0.08943250 0.12481348 0.20276240 [55] 0.46720320 -0.10203302 -0.12014542 -0.25746723 -0.09222451 -0.15697602 > postscript(file="/var/www/html/rcomp/tmp/2gybj1260626475.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/3mmrc1260626475.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/450o71260626475.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/53bdr1260626475.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/6f4zp1260626475.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/75equ1260626475.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/8pdjk1260626475.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/9655f1260626475.tab") > system("convert tmp/1ra6x1260626475.ps tmp/1ra6x1260626475.png") > system("convert tmp/2gybj1260626475.ps tmp/2gybj1260626475.png") > system("convert tmp/3mmrc1260626475.ps tmp/3mmrc1260626475.png") > system("convert tmp/450o71260626475.ps tmp/450o71260626475.png") > system("convert tmp/53bdr1260626475.ps tmp/53bdr1260626475.png") > system("convert tmp/6f4zp1260626475.ps tmp/6f4zp1260626475.png") > system("convert tmp/75equ1260626475.ps tmp/75equ1260626475.png") > > > proc.time() user system elapsed 6.113 1.036 7.109