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(102.1,102.86,102.99,103.73,105.02,104.43,104.63,104.93,105.87,105.66,106.76,106,107.22,107.33,107.11,108.86,107.72,107.88,108.38,107.72,108.41,109.9,111.45,112.18,113.34,113.46,114.06,115.54,116.39,115.94,116.97,115.94,115.91,116.43,116.26,116.35,117.9,117.7,117.53,117.86,117.65,116.51,115.93,115.31,115) > 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(11) #degree (p) of the non-seasonal AR(p) polynomial > 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(11,par3,par7), seasonal=list(order=c(par8,par4,par9), period=par5))) [[1]] [,1] [,2] [,3] [,4] [,5] [,6] [1,] -0.01378023 0.3255385 0.2696725 -0.2085646 -0.07259227 0.2567189 [2,] -0.01320975 0.3257144 0.2688347 -0.2077115 -0.07056098 0.2563048 [3,] 0.00000000 0.3256480 0.2641819 -0.2121234 -0.06805856 0.2575767 [4,] 0.00000000 0.3206486 0.2539302 -0.1952973 -0.04489376 0.2525804 [5,] 0.00000000 0.3085917 0.2412049 -0.1964836 0.00000000 0.2584474 [6,] 0.00000000 0.3154730 0.2632944 -0.1932738 0.00000000 0.2897935 [7,] 0.00000000 0.3005360 0.2784892 -0.1402655 0.00000000 0.2546991 [8,] 0.00000000 0.2593681 0.2850258 -0.1164392 0.00000000 0.2155170 [9,] 0.00000000 0.2280908 0.2982304 0.0000000 0.00000000 0.1784311 [10,] 0.00000000 0.2329783 0.3687644 0.0000000 0.00000000 0.0000000 [11,] 0.00000000 0.0000000 0.3811369 0.0000000 0.00000000 0.0000000 [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.06846096 -0.1208055 0.05941546 0.08782076 0.006354765 [2,] 0.06650258 -0.1187452 0.06205366 0.08764662 0.000000000 [3,] 0.06309095 -0.1207109 0.06366181 0.08697902 0.000000000 [4,] 0.00000000 -0.1300494 0.08708737 0.10666243 0.000000000 [5,] 0.00000000 -0.1450190 0.09306906 0.10383626 0.000000000 [6,] 0.00000000 -0.1550044 0.00000000 0.10935591 0.000000000 [7,] 0.00000000 -0.1122744 0.00000000 0.00000000 0.000000000 [8,] 0.00000000 0.0000000 0.00000000 0.00000000 0.000000000 [9,] 0.00000000 0.0000000 0.00000000 0.00000000 0.000000000 [10,] 0.00000000 0.0000000 0.00000000 0.00000000 0.000000000 [11,] 0.00000000 0.0000000 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.92704 0.03686 0.10826 0.25265 0.69009 0.15200 0.70561 0.50429 0.74588 [2,] 0.92968 0.03647 0.10603 0.25039 0.68437 0.15167 0.70117 0.48998 0.71324 [3,] NA 0.03631 0.09344 0.22170 0.69091 0.14805 0.70855 0.47895 0.70440 [4,] NA 0.03808 0.10102 0.24436 0.77747 0.15489 NA 0.44098 0.57636 [5,] NA 0.03735 0.10256 0.24189 NA 0.14233 NA 0.36526 0.54737 [6,] NA 0.03380 0.06673 0.25210 NA 0.08581 NA 0.33347 NA [7,] NA 0.04106 0.05185 0.34822 NA 0.11303 NA 0.44835 NA [8,] NA 0.05777 0.04723 0.42258 NA 0.15892 NA NA NA [9,] NA 0.07913 0.03800 NA NA 0.22269 NA NA NA [10,] NA 0.08345 0.00768 NA NA NA NA NA NA [11,] NA NA 0.00795 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.60407 0.97053 [2,] 0.60456 NA [3,] 0.60682 NA [4,] 0.50665 NA [5,] 0.51775 NA [6,] 0.49675 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.0138 0.3255 0.2697 -0.2086 -0.0726 0.2567 0.0685 -0.1208 s.e. 0.1494 0.1496 0.1634 0.1791 0.1805 0.1751 0.1797 0.1789 ar9 ar10 ar11 0.0594 0.0878 0.0064 s.e. 0.1818 0.1677 0.1707 sigma^2 estimated as 0.4898: log likelihood = -47.33, aic = 118.65 [[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.0138 0.3255 0.2697 -0.2086 -0.0726 0.2567 0.0685 -0.1208 s.e. 0.1494 0.1496 0.1634 0.1791 0.1805 0.1751 0.1797 0.1789 ar9 ar10 ar11 0.0594 0.0878 0.0064 s.e. 0.1818 0.1677 0.1707 sigma^2 estimated as 0.4898: log likelihood = -47.33, aic = 118.65 [[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.0132 0.3257 0.2688 -0.2077 -0.0706 0.2563 0.0665 -0.1187 s.e. 0.1486 0.1496 0.1619 0.1776 0.1721 0.1748 0.1718 0.1701 ar9 ar10 ar11 0.0621 0.0876 0 s.e. 0.1674 0.1677 0 sigma^2 estimated as 0.4898: log likelihood = -47.33, aic = 116.65 [[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 0.3256 0.2642 -0.2121 -0.0681 0.2576 0.0631 -0.1207 0.0637 s.e. 0 0.1496 0.1532 0.1705 0.1698 0.1741 0.1674 0.1687 0.1664 ar10 ar11 0.0870 0 s.e. 0.1675 0 sigma^2 estimated as 0.4899: log likelihood = -47.33, aic = 114.66 [[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 0.3206 0.2539 -0.1953 -0.0449 0.2526 0 -0.1300 0.0871 s.e. 0 0.1489 0.1509 0.1650 0.1577 0.1738 0 0.1669 0.1545 ar10 ar11 0.1067 0 s.e. 0.1590 0 sigma^2 estimated as 0.4916: log likelihood = -47.4, aic = 112.8 [[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 0.3086 0.2412 -0.1965 0 0.2584 0 -0.1450 0.0931 0.1038 s.e. 0 0.1429 0.1441 0.1652 0 0.1724 0 0.1582 0.1533 0.1590 ar11 0 s.e. 0 sigma^2 estimated as 0.4924: log likelihood = -47.44, aic = 110.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 0.3155 0.2633 -0.1933 0 0.2898 0 -0.1550 0 0.1094 s.e. 0 0.1433 0.1395 0.1662 0 0.1643 0 0.1582 0 0.1594 ar11 0 s.e. 0 sigma^2 estimated as 0.4971: log likelihood = -47.63, aic = 109.25 [[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 0.3005 0.2785 -0.1403 0 0.2547 0 -0.1123 0 0 0 s.e. 0 0.1422 0.1388 0.1477 0 0.1571 0 0.1466 0 0 0 sigma^2 estimated as 0.5042: log likelihood = -47.86, aic = 107.72 [[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 0.2594 0.2850 -0.1164 0 0.2155 0 0 0 0 0 s.e. 0 0.1328 0.1392 0.1437 0 0.1501 0 0 0 0 0 sigma^2 estimated as 0.5121: log likelihood = -48.15, aic = 106.3 [[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 0.2281 0.2982 0 0 0.1784 0 0 0 0 0 s.e. 0 0.1267 0.1391 0 0 0.1441 0 0 0 0 0 sigma^2 estimated as 0.5203: log likelihood = -48.47, aic = 104.95 [[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 0.2330 0.3688 0 0 0 0 0 0 0 0 s.e. 0 0.1314 0.1317 0 0 0 0 0 0 0 0 sigma^2 estimated as 0.5409: log likelihood = -49.22, aic = 104.43 $aic [1] 118.6519 116.6533 114.6612 112.8031 110.8842 109.2503 107.7158 106.2958 [9] 104.9466 104.4333 105.4322 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/1ip611260559695.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 = 45 Frequency = 1 [1] 0.10209994 0.67392046 0.02371384 0.48530225 0.97945189 -0.81034333 [7] -0.37342769 -0.03824883 1.11097532 -0.35364638 0.77037105 -1.05771307 [13] 1.04116435 -0.11857728 -0.22397264 1.27447984 -1.12930885 -0.16658392 [19] 0.12025764 -0.27688514 0.51450853 1.45938351 1.63262944 0.12841486 [25] 0.24942466 -0.62165897 0.06054714 1.02427592 0.66596128 -1.01606656 [31] 0.28619714 -1.23860947 -0.10402371 0.38014037 0.21681666 -0.02008580 [37] 1.39784884 -0.15827811 -0.56430521 -0.19498912 -0.09664081 -1.15419291 [43] -0.65276680 -0.27696418 0.24551882 > postscript(file="/var/www/html/rcomp/tmp/2ueu71260559695.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/3hzox1260559695.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/4cqop1260559695.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/5znkt1260559695.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/6nby11260559695.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/7gfiw1260559695.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/8qksx1260559695.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/9gc1f1260559695.tab") > > system("convert tmp/1ip611260559695.ps tmp/1ip611260559695.png") > system("convert tmp/2ueu71260559695.ps tmp/2ueu71260559695.png") > system("convert tmp/3hzox1260559695.ps tmp/3hzox1260559695.png") > system("convert tmp/4cqop1260559695.ps tmp/4cqop1260559695.png") > system("convert tmp/5znkt1260559695.ps tmp/5znkt1260559695.png") > system("convert tmp/6nby11260559695.ps tmp/6nby11260559695.png") > system("convert tmp/7gfiw1260559695.ps tmp/7gfiw1260559695.png") > > > proc.time() user system elapsed 2.644 1.030 3.946