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 = '1' > par8 = '2' > par7 = '1' > 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 <- 3 > par7 <- as.numeric(par7) #degree (q) of the non-seasonal MA(q) polynomial > par7 <- 3 > 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] [,7] [1,] 0.9740862 0.3207086 -0.3495235 -0.5262519 -0.6738170 0.2049834 0.8004929 [2,] 1.2090630 0.0000000 -0.2536213 -0.7663885 -0.4721460 0.2338715 0.8130242 [3,] 1.2190145 0.0000000 -0.2667324 -0.7662842 -0.4659396 0.2426918 -1.0907879 [4,] NA NA NA NA NA NA NA [5,] NA NA NA NA NA NA NA [6,] NA NA NA NA NA NA NA [7,] NA NA NA NA NA NA NA [8,] NA NA NA NA NA NA NA [9,] NA NA NA NA NA NA NA [10,] NA NA NA NA NA NA NA [11,] NA NA NA NA NA NA NA [12,] NA NA NA NA NA NA NA [13,] NA NA NA NA NA NA NA [14,] NA NA NA NA NA NA NA [15,] NA NA NA NA NA NA NA [16,] NA NA NA NA NA NA NA [17,] NA NA NA NA NA NA NA [18,] NA NA NA NA NA NA NA [,8] [,9] [1,] 0.05121531 -0.8005578 [2,] 0.05034946 -0.8150301 [3,] 0.00000000 1.0776247 [4,] NA NA [5,] NA NA [6,] NA 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 [[2]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 0.0195 0.54716 0.03663 0.2034 0.03966 0.15058 0.00072 0.41935 0.00060 [2,] 0.0000 NA 0.00026 0.0000 0.00000 0.03774 0.00035 0.42622 0.00027 [3,] 0.0000 NA 0.00008 0.0000 0.00000 0.02644 0.00000 NA 0.00000 [4,] NA NA NA NA NA NA NA NA NA [5,] NA NA NA NA NA NA NA NA NA [6,] NA NA NA NA NA NA NA NA NA [7,] NA NA NA NA NA NA NA NA NA [8,] NA NA NA NA NA NA NA NA NA [9,] NA NA NA NA 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 [[3]] [[3]][[1]] Call: arima(x = series, order = order, seasonal = seasonal, include.mean = include.mean, method = "ML") Coefficients: ar1 ar2 ar3 ma1 ma2 ma3 sar1 sar2 0.9741 0.3207 -0.3495 -0.5263 -0.6738 0.2050 0.8005 0.0512 s.e. 0.4151 0.5322 0.1666 0.4130 0.3263 0.1423 0.2345 0.0633 sma1 -0.8006 s.e. 0.2312 sigma^2 estimated as 106.3: log likelihood = -1348.1, aic = 2716.2 [[3]][[2]] Call: arima(x = series, order = order, seasonal = seasonal, include.mean = include.mean, method = "ML") Coefficients: ar1 ar2 ar3 ma1 ma2 ma3 sar1 sar2 0.9741 0.3207 -0.3495 -0.5263 -0.6738 0.2050 0.8005 0.0512 s.e. 0.4151 0.5322 0.1666 0.4130 0.3263 0.1423 0.2345 0.0633 sma1 -0.8006 s.e. 0.2312 sigma^2 estimated as 106.3: log likelihood = -1348.1, aic = 2716.2 [[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 ma1 ma2 ma3 sar1 sar2 sma1 1.2091 0 -0.2536 -0.7664 -0.4721 0.2339 0.8130 0.0503 -0.8150 s.e. 0.0724 0 0.0688 0.0985 0.0658 0.1121 0.2253 0.0632 0.2212 sigma^2 estimated as 105.4: log likelihood = -1348.2, aic = 2714.4 [[3]][[4]] NULL [[3]][[5]] NULL [[3]][[6]] NULL [[3]][[7]] NULL [[3]][[8]] NULL [[3]][[9]] NULL $aic [1] 2716.204 2714.396 2707.919 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 > postscript(file="/var/www/html/rcomp/tmp/1eumo1261164443.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.25499983 21.83516650 8.22258798 30.64669178 15.86009290 [6] 6.15609668 -12.28637112 -3.20428310 -2.09622499 0.31657450 [11] -5.88624138 3.25256369 -1.19481877 2.15749514 0.77074094 [16] -8.31360267 1.83727350 -5.25666328 0.88363819 -11.81844294 [21] 0.09826444 -1.35781552 2.27946748 -1.53834910 -3.75228268 [26] -3.66476274 -5.96586643 -2.42104339 -2.17583200 4.75886548 [31] 19.24993495 16.28684111 -0.31236212 0.35046947 1.66688149 [36] 0.62749451 -12.05185627 11.28375367 -10.02333612 0.43221580 [41] 2.60116610 -1.03972653 9.21962864 -4.76111809 -7.45299406 [46] -1.14902195 -10.49227087 -2.83335763 0.18051044 -14.17736470 [51] 1.36513404 -2.58406552 -1.99006803 0.30967156 -5.63531565 [56] -1.56429373 -2.13242519 -0.52215857 -5.22043485 8.71105300 [61] -7.62919049 10.81186795 -6.72139805 -0.04504930 -3.33297821 [66] -2.35184936 -4.59539744 1.83474292 -2.87469574 -2.11859977 [71] -0.90932682 -0.11356625 0.64257699 -0.41277374 -1.27597923 [76] -5.64046538 -0.17179996 -2.28998414 -2.11679910 0.82597440 [81] -3.47916142 1.08694930 0.97574958 -4.46581810 4.86264805 [86] 1.18582233 -4.37442057 0.57800269 -0.84540085 2.48042806 [91] -0.40153040 -2.02595398 1.33992605 -0.22641506 -1.19159273 [96] 0.53196720 -0.47958487 1.14190113 -0.55013039 -1.08863103 [101] -1.27008256 0.61964674 -0.45620675 -5.50582770 1.38636105 [106] 0.75378450 -1.12627817 -7.91102084 23.27554010 72.19323883 [111] -14.25826019 -8.68992808 -5.04836306 2.31849861 -3.71819503 [116] -6.03871212 -10.46439374 9.81507993 6.31311819 1.48911274 [121] -0.77238173 -5.06859106 0.03047946 -5.77927484 -4.05900701 [126] 3.43787320 -1.73274282 -6.87099695 8.50445103 4.14421693 [131] -13.00537674 2.44851995 8.82335559 -7.42318403 -4.83242644 [136] 9.98655382 -5.62660925 0.39090989 5.53104245 -5.93208863 [141] 4.01864431 -0.36578464 3.91196643 1.40475532 2.34393253 [146] 3.90567107 -3.60460288 9.81086901 1.33165781 0.12428196 [151] 6.08911860 -5.89715204 -2.79737430 -3.12871665 -8.66288108 [156] 10.18348053 -4.77009462 5.58240049 -9.26649811 4.55867534 [161] 4.46262340 2.82848577 5.86565050 -4.56563387 1.98160564 [166] -0.31946026 -7.04798082 3.73823853 -0.68171632 1.46864520 [171] -7.67065908 6.93315282 -6.45119536 2.22798415 -7.16211370 [176] -3.12040993 -0.53649143 2.46728798 -3.54290208 -3.96672065 [181] 4.51413101 -2.94646119 -5.19686882 -1.05252399 4.37152967 [186] -6.54005692 3.24102493 -5.70605243 -5.65359967 -3.32033284 [191] -8.06611304 -0.08117465 -2.72790917 7.54403262 -4.06987415 [196] -0.13314983 0.50932824 -1.06010553 -1.17484519 -5.56652835 [201] 0.21262183 -9.68118891 5.51174294 0.96243845 1.92875702 [206] -5.67496938 -0.64062047 -1.84832793 0.88022582 4.09558757 [211] 69.80526552 80.52699222 -45.34408454 6.90347628 -0.32440441 [216] -2.00242031 9.30270515 -12.25095350 3.31593443 6.72345047 [221] 5.92880644 5.49277009 2.29385190 10.37142441 -1.85194683 [226] -4.78228171 5.19734949 -0.38654480 -10.53871767 11.14901851 [231] -1.01163881 4.03750265 -5.75670456 6.41494101 -7.97816080 [236] 4.29110961 -2.86846672 6.72572945 -5.37923327 7.88374738 [241] -2.56464736 4.37274304 20.27100691 30.77281543 7.28940007 [246] 26.42732089 4.68424249 -0.48283379 -0.91582007 -13.90131491 [251] 7.02700225 -5.77890656 -0.24557619 3.73708929 14.56271938 [256] -6.25660101 0.70472777 -3.80915019 4.61353555 -5.85545391 [261] 0.77129835 -6.16039857 6.62241414 -1.69863441 3.48180823 [266] -0.17919661 7.22862317 -4.09705731 5.41030037 -9.79803891 [271] 3.46416244 -1.26413253 0.61478853 11.84404894 -16.93738410 [276] 10.02036849 17.19491663 7.47358078 -9.11420442 -2.51360217 [281] -2.85927293 -6.57469452 5.23188468 -1.19501438 -6.28683241 [286] 4.19622072 -6.09679512 2.06073767 2.16955459 -0.76876762 [291] -1.38498273 -7.81662705 0.22255514 6.05742239 -9.89703378 [296] -3.04364586 0.21771481 0.35638988 -1.93747354 -6.90891866 [301] 3.89180866 -2.28485425 -9.19149171 13.49336176 -3.61816615 [306] -7.73485198 3.08242478 -8.54439692 3.03918116 -6.48459384 [311] 4.21544924 -7.17746396 17.16168440 -17.73129914 5.85373516 [316] 2.69320570 -9.16486677 0.81943949 -1.13187248 -3.66180755 [321] 1.20159597 -10.26164316 -0.02118758 9.47199162 -4.00365228 [326] -5.11983289 7.57917317 -7.86670638 -6.46934121 -6.78818240 [331] 14.15116605 -7.63431698 1.70409429 -5.87224074 -4.08147610 [336] 0.87088551 24.55415578 -23.80028742 13.82628040 13.79289807 [341] 1.99808624 4.43334065 -12.97332121 19.45811439 -10.23002409 [346] 6.48098040 -16.41799566 4.08281025 -0.48823134 -2.45295243 [351] 14.90874755 -6.53070793 9.17431843 -22.43871550 9.03306443 [356] 1.85892546 -0.20142912 -2.25467457 4.77202871 -5.83977355 > postscript(file="/var/www/html/rcomp/tmp/2efbr1261164443.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/3r09n1261164443.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/43vz41261164443.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/5lq3t1261164443.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/6i9pk1261164443.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/7vgdf1261164443.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/8fus11261164443.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/964481261164443.tab") > try(system("convert tmp/1eumo1261164443.ps tmp/1eumo1261164443.png",intern=TRUE)) character(0) > try(system("convert tmp/2efbr1261164443.ps tmp/2efbr1261164443.png",intern=TRUE)) character(0) > try(system("convert tmp/3r09n1261164443.ps tmp/3r09n1261164443.png",intern=TRUE)) character(0) > try(system("convert tmp/43vz41261164443.ps tmp/43vz41261164443.png",intern=TRUE)) character(0) > try(system("convert tmp/5lq3t1261164443.ps tmp/5lq3t1261164443.png",intern=TRUE)) character(0) > try(system("convert tmp/6i9pk1261164443.ps tmp/6i9pk1261164443.png",intern=TRUE)) character(0) > try(system("convert tmp/7vgdf1261164443.ps tmp/7vgdf1261164443.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 29.205 2.914 32.978