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(10284.5,12792,12823.61538,13845.66667,15335.63636,11188.5,13633.25,12298.46667,15353.63636,12696.15385,12213.93333,13683.72727,11214.14286,13950.23077,11179.13333,11801.875,11188.82353,16456.27273,11110.0625,16530.69231,10038.41176,11681.25,11148.88235,8631,9386.444444,9764.736842,12043.75,12948.06667,10987.125,11648.3125,10633.35294,10219.3,9037.6,10296.31579,11705.41176,10681.94444,9362.947368,11306.35294,10984.45,10062.61905,8118.583333,8867.48,8346.72,8529.307692,10697.18182,8591.84,8695.607143,8125.571429,7009.758621,7883.466667,7527.645161,6763.758621,6682.333333,7855.681818,6738.88,7895.434783,6361.884615,6935.956522,8344.454545,9107.944444) > 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.8512777 -0.3325628 -0.3548842 -0.3623492 -0.1603324 -0.18410025 [2,] -0.8394088 -0.3121394 -0.3320917 -0.3332967 -0.1291101 -0.15628995 [3,] -0.8190077 -0.2686129 -0.2837498 -0.2514095 0.0000000 -0.07881707 [4,] -0.8233605 -0.2638615 -0.2670624 -0.2601421 0.0000000 0.00000000 [5,] -0.8095950 -0.2751287 -0.2614654 -0.2120285 0.0000000 0.00000000 [6,] -0.7687114 -0.1973589 -0.2368599 -0.2208847 0.0000000 0.00000000 [7,] -0.7303411 -0.1784650 -0.2542199 -0.2382144 0.0000000 0.00000000 [8,] -0.6436607 0.0000000 -0.1508112 -0.2136828 0.0000000 0.00000000 [9,] -0.6757293 0.0000000 0.0000000 -0.1197787 0.0000000 0.00000000 [10,] -0.6448580 0.0000000 0.0000000 0.0000000 0.0000000 0.00000000 [11,] -0.6441694 0.0000000 0.0000000 0.0000000 0.0000000 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.2460071 -0.06346193 0.2241913 0.2361919 0.1549013 [2,] -0.2023845 0.00000000 0.2638251 0.2538603 0.1649821 [3,] -0.1834204 0.00000000 0.2831014 0.2756566 0.1734947 [4,] -0.1358796 0.00000000 0.2962495 0.2969221 0.1802554 [5,] 0.0000000 0.00000000 0.2449259 0.3169474 0.2096269 [6,] 0.0000000 0.00000000 0.2257754 0.1558204 0.0000000 [7,] 0.0000000 0.00000000 0.1183872 0.0000000 0.0000000 [8,] 0.0000000 0.00000000 0.1235305 0.0000000 0.0000000 [9,] 0.0000000 0.00000000 0.1312198 0.0000000 0.0000000 [10,] 0.0000000 0.00000000 0.1354536 0.0000000 0.0000000 [11,] 0.0000000 0.00000000 0.0000000 0.0000000 0.0000000 [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.06693 0.05399 0.05737 0.38977 0.31917 0.18345 0.72608 0.21231 [2,] 0 0.06885 0.05292 0.05005 0.42792 0.34754 0.13690 NA 0.05978 [3,] 0 0.09730 0.07245 0.06114 NA 0.55825 0.16988 NA 0.03974 [4,] 0 0.10269 0.08446 0.05146 NA NA 0.20072 NA 0.03010 [5,] 0 0.09414 0.09674 0.09784 NA NA NA NA 0.06443 [6,] 0 0.22062 0.14660 0.09140 NA NA NA NA 0.09315 [7,] 0 0.27368 0.12338 0.07196 NA NA NA NA 0.22282 [8,] 0 NA 0.26708 0.10393 NA NA NA NA 0.20653 [9,] 0 NA NA 0.23503 NA NA NA NA 0.18430 [10,] 0 NA NA NA NA NA NA NA 0.17839 [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.18592 0.25594 [2,] 0.13953 0.21733 [3,] 0.10179 0.19156 [4,] 0.07157 0.17349 [5,] 0.05821 0.11287 [6,] 0.24914 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.8513 -0.3326 -0.3549 -0.3623 -0.1603 -0.1841 -0.2460 -0.0635 s.e. 0.1339 0.1774 0.1797 0.1861 0.1847 0.1829 0.1823 0.1801 ar9 ar10 ar11 0.2242 0.2362 0.1549 s.e. 0.1774 0.1760 0.1347 sigma^2 estimated as 2055550: log likelihood = -513.58, aic = 1051.16 [[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.8513 -0.3326 -0.3549 -0.3623 -0.1603 -0.1841 -0.2460 -0.0635 s.e. 0.1339 0.1774 0.1797 0.1861 0.1847 0.1829 0.1823 0.1801 ar9 ar10 ar11 0.2242 0.2362 0.1549 s.e. 0.1774 0.1760 0.1347 sigma^2 estimated as 2055550: log likelihood = -513.58, aic = 1051.16 [[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 -0.8394 -0.3121 -0.3321 -0.3333 -0.1291 -0.1563 -0.2024 0 s.e. 0.1297 0.1678 0.1674 0.1659 0.1615 0.1648 0.1338 0 ar9 ar10 ar11 0.2638 0.2539 0.165 s.e. 0.1369 0.1690 0.132 sigma^2 estimated as 2061200: log likelihood = -513.64, aic = 1049.29 [[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.8190 -0.2686 -0.2837 -0.2514 0 -0.0788 -0.1834 0 0.2831 s.e. 0.1284 0.1590 0.1546 0.1312 0 0.1337 0.1317 0 0.1341 ar10 ar11 0.2757 0.1735 s.e. 0.1654 0.1311 sigma^2 estimated as 2081552: log likelihood = -513.96, aic = 1047.93 [[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.8234 -0.2639 -0.2671 -0.2601 0 0 -0.1359 0 0.2962 s.e. 0.1285 0.1588 0.1518 0.1304 0 0 0.1048 0 0.1328 ar10 ar11 0.2969 0.1803 s.e. 0.1614 0.1306 sigma^2 estimated as 2094560: log likelihood = -514.14, aic = 1046.28 [[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.8096 -0.2751 -0.2615 -0.2120 0 0 0 0 0.2449 0.3169 s.e. 0.1295 0.1614 0.1546 0.1258 0 0 0 0 0.1296 0.1636 ar11 0.2096 s.e. 0.1300 sigma^2 estimated as 2161530: log likelihood = -514.96, aic = 1045.92 [[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.7687 -0.1974 -0.2369 -0.2209 0 0 0 0 0.2258 0.1558 s.e. 0.1290 0.1592 0.1608 0.1285 0 0 0 0 0.1320 0.1337 ar11 0 s.e. 0 sigma^2 estimated as 2273677: log likelihood = -516.2, aic = 1046.4 [[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.7303 -0.1785 -0.2542 -0.2382 0 0 0 0 0.1184 0 s.e. 0.1270 0.1614 0.1624 0.1298 0 0 0 0 0.0960 0 ar11 0 s.e. 0 sigma^2 estimated as 2337045: log likelihood = -516.86, aic = 1045.73 [[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.6437 0 -0.1508 -0.2137 0 0 0 0 0.1235 0 0 s.e. 0.1010 0 0.1345 0.1292 0 0 0 0 0.0966 0 0 sigma^2 estimated as 2387604: log likelihood = -517.47, aic = 1044.94 [[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.6757 0 0 -0.1198 0 0 0 0 0.1312 0 0 s.e. 0.0980 0 0 0.0998 0 0 0 0 0.0976 0 0 sigma^2 estimated as 2441769: log likelihood = -518.09, aic = 1044.18 [[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.6449 0 0 0 0 0 0 0 0.1355 0 0 s.e. 0.0963 0 0 0 0 0 0 0 0.0994 0 0 sigma^2 estimated as 2505878: log likelihood = -518.8, aic = 1043.59 $aic [1] 1051.165 1049.289 1047.930 1046.276 1045.918 1046.401 1045.727 1044.937 [9] 1044.178 1043.593 1043.378 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/17d351260470690.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] 10.28449 1850.84869 1662.04488 1045.24777 2107.33246 -3061.78630 [7] -374.47357 382.05835 1996.99682 -423.45165 -2535.56929 1154.54778 [13] -1660.21666 941.73491 -444.96463 -1495.37288 -30.67028 4458.28421 [19] -1589.48798 2038.40210 -3195.83320 -2209.24636 156.41659 -2485.82862 [25] -952.58467 948.48682 1809.46283 3098.12011 -2112.02993 276.06172 [31] -811.11596 -996.44655 -1107.64899 394.35943 2169.54779 -423.50120 [37] -2101.48111 1358.45650 841.75736 -991.93265 -2482.40077 -344.66467 [43] -208.32566 -344.09573 2424.24963 -528.70797 -1517.12066 -459.51772 [49] -1358.53951 417.49400 106.15530 -922.80203 -598.75577 827.19429 [55] -74.98248 422.32060 -710.52319 -263.70922 1660.34592 1719.96838 > postscript(file="/var/www/html/rcomp/tmp/23g751260470690.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/32rih1260470690.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/4k5t11260470690.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/5wzg01260470690.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/6t1zx1260470690.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/7wlta1260470690.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/8vlbn1260470690.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/9j4ng1260470690.tab") > > system("convert tmp/17d351260470690.ps tmp/17d351260470690.png") > system("convert tmp/23g751260470690.ps tmp/23g751260470690.png") > system("convert tmp/32rih1260470690.ps tmp/32rih1260470690.png") > system("convert tmp/4k5t11260470690.ps tmp/4k5t11260470690.png") > system("convert tmp/5wzg01260470690.ps tmp/5wzg01260470690.png") > system("convert tmp/6t1zx1260470690.ps tmp/6t1zx1260470690.png") > system("convert tmp/7wlta1260470690.ps tmp/7wlta1260470690.png") > > > proc.time() user system elapsed 2.667 1.049 3.251