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(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 = '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] [1,] 1.0048119 0.2452576 -0.3053853 -0.5600230 -0.6211819 0.1900455 [2,] 1.1898083 0.0000000 -0.2370693 -0.7430754 -0.4656976 0.2167942 [3,] -0.5483005 0.0000000 0.1655398 1.0206396 0.3686054 0.0000000 [4,] 0.0000000 0.0000000 0.1025918 0.4739888 0.1079439 0.0000000 [5,] 0.0000000 0.0000000 0.0000000 0.4710204 0.0651052 0.0000000 [6,] 0.0000000 0.0000000 0.0000000 0.4526164 0.0000000 0.0000000 [7,] NA NA NA NA NA NA [8,] NA NA NA NA NA NA [9,] NA NA NA NA NA NA [10,] NA NA NA NA NA NA [11,] NA NA NA NA NA NA [12,] NA NA NA NA NA NA [[2]] [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0.03601 0.68293 0.07948 0.24059 0.09624 0.21983 [2,] 0.00000 NA 0.00143 0.00000 0.00000 0.06351 [3,] 0.40757 NA 0.08627 0.12489 0.25696 NA [4,] NA NA 0.08621 0.00000 0.07237 NA [5,] NA NA NA 0.00000 0.20633 NA [6,] NA NA NA 0.00000 NA NA [7,] NA NA NA NA NA NA [8,] NA NA NA NA NA NA [9,] NA NA NA NA NA NA [10,] NA NA NA NA NA NA [11,] NA NA NA NA NA NA [12,] 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 1.0048 0.2453 -0.3054 -0.5600 -0.6212 0.1900 s.e. 0.4774 0.5999 0.1736 0.4764 0.3724 0.1546 sigma^2 estimated as 106.8: log likelihood = -1344.94, aic = 2703.89 [[3]][[2]] Call: arima(x = series, order = order, seasonal = seasonal, include.mean = include.mean, method = "ML") Coefficients: ar1 ar2 ar3 ma1 ma2 ma3 1.0048 0.2453 -0.3054 -0.5600 -0.6212 0.1900 s.e. 0.4774 0.5999 0.1736 0.4764 0.3724 0.1546 sigma^2 estimated as 106.8: log likelihood = -1344.94, aic = 2703.89 [[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 1.1898 0 -0.2371 -0.7431 -0.4657 0.2168 s.e. 0.0777 0 0.0738 0.0987 0.0650 0.1165 sigma^2 estimated as 106.9: log likelihood = -1345.02, aic = 2702.05 [[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 ma1 ma2 ma3 -0.5483 0 0.1655 1.0206 0.3686 0 s.e. 0.6613 0 0.0962 0.6635 0.3246 0 sigma^2 estimated as 110.6: log likelihood = -1350.52, aic = 2711.05 [[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 ma1 ma2 ma3 0 0 0.1026 0.4740 0.1079 0 s.e. 0 0 0.0596 0.0522 0.0599 0 sigma^2 estimated as 110.7: log likelihood = -1350.69, aic = 2709.39 [[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 ma1 ma2 ma3 0 0 0 0.4710 0.0651 0 s.e. 0 0 0 0.0514 0.0514 0 sigma^2 estimated as 111.7: log likelihood = -1352.18, aic = 2710.36 $aic [1] 2703.886 2702.047 2711.046 2709.390 2710.357 2709.945 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 > postscript(file="/var/www/html/rcomp/tmp/1ubj81260462779.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 = 359 Frequency = 1 [1] 0.280199828 17.791002603 30.919086808 19.401226407 8.168950236 [6] -9.409880740 -3.599568817 -4.191898597 -3.991179708 -9.447158641 [11] -0.590349220 -4.706874368 -1.344531451 -1.660256307 -11.130449461 [16] -0.049240166 -7.852156780 -1.698268349 -13.588864790 -1.888801665 [21] -2.625630213 0.459696141 -1.545584080 -3.601927009 -2.302793421 [26] -5.680833205 -0.674287974 -1.212544861 5.315032991 19.575454119 [31] 17.033525920 1.502398384 3.083368693 2.749856568 0.504018193 [36] -12.316432792 11.368476635 -11.552920394 -0.598485964 3.034054237 [41] -3.690136830 8.440596950 -6.835446089 -8.329892316 -1.531427906 [46] -12.536346972 -3.795421186 -0.696097943 -15.025022041 1.622411166 [51] -2.085981711 -1.723087502 2.047417577 -4.252193452 0.269572247 [56] -0.750134132 0.735777909 -3.497728759 10.599598560 -6.564906610 [61] 13.802115852 -4.973668302 1.744109664 0.002300457 -1.914634165 [66] -1.998318062 2.365901164 -2.384286772 -1.330984801 -0.117849576 [71] 0.642163579 1.405200488 0.896313748 -0.313667895 -4.010610712 [76] 1.509500787 -1.249894034 -0.809550784 1.962689513 -3.071760795 [81] 2.319080647 1.507653345 -3.061119651 5.743693670 2.993898028 [86] -3.984131288 2.681688709 0.296257619 3.185864754 0.880104866 [91] -1.321963678 1.865372432 0.107438275 -1.272051056 1.592167180 [96] -0.667126054 2.210571610 -0.597790904 -0.662348001 -0.449101300 [101] 0.754658161 -0.026220544 -5.236781757 1.268338020 0.843528650 [106] -1.579894580 -7.110755555 23.752170122 73.175190970 -15.613395868 [111] -4.209857546 -0.900558099 -2.501735181 -6.063000736 -10.481327137 [116] -14.268348468 5.703071762 1.842680608 -1.839239725 -2.353648691 [121] -6.671639439 -2.304287104 -7.880275419 -5.938208623 2.010064154 [126] -3.560172940 -8.153951615 7.972463137 3.175672015 -14.014855014 [131] 3.294529567 9.460649324 -4.370649623 -5.057272392 10.366630360 [136] -6.353639446 0.817772153 6.228467595 -7.286976382 3.926808769 [141] 0.124813075 3.385554842 1.697208696 2.880162904 7.332887472 [146] -4.941453006 9.450115987 0.670517057 -0.531078856 6.006494819 [151] -8.194605471 -3.831227852 -3.661902207 -11.525736594 9.067265678 [156] -5.520481569 6.809933207 -10.248205281 3.783751494 4.184987356 [161] 1.682443786 6.635070267 -5.934789143 2.163429077 -0.132633570 [166] -8.578377360 3.649225688 -0.760362723 2.720562782 -8.931936948 [171] 7.030001550 -7.229758483 1.647673947 -6.405393161 -5.190201423 [176] -0.338284980 1.897248202 -4.171618457 -2.958603411 5.965156538 [181] -0.617089836 -5.797700800 0.871010982 4.767196527 -5.802154055 [186] 5.122563534 -5.935081437 -5.137961199 -1.693510927 -8.967813868 [191] 1.634279447 -1.385927640 10.546400078 -3.877338268 2.639679891 [196] 2.709091848 0.452105654 1.110673067 -5.352584076 1.748865591 [201] -8.275270295 5.583960711 2.608603809 3.407749587 -1.874953165 [206] -0.738721057 0.570021866 1.679602664 5.471761531 71.613337950 [211] 79.812418325 -44.455675944 14.943326148 -0.944315628 -10.528096280 [216] 6.620427752 -18.832922611 -4.160333908 0.785723179 -1.799232273 [221] -0.003679595 -3.081127465 3.851513386 -7.113543885 -10.000129400 [226] 0.073393410 -5.583509403 -14.874831579 8.669864281 -7.115253925 [231] 0.486976382 -8.066135795 3.167609644 -6.766861339 3.981101743 [236] -7.134622214 4.201362047 -7.614426162 5.713019393 -2.895209848 [241] 2.591755589 18.567723507 29.285487084 6.497083495 26.933103882 [246] 6.890965311 -0.899270110 -5.225063103 -19.980341641 0.851326847 [251] -13.300168227 -7.390775526 -0.852884048 6.882903659 -10.586460705 [256] -3.561674064 -6.833145330 1.950434191 -7.173820982 -5.147967525 [261] -8.808149362 2.383977286 -4.149445590 0.699264124 -0.759217182 [266] 5.112081037 -3.358465362 4.149082587 -9.135648905 3.932949970 [271] -0.457721368 -3.540459388 10.597428562 -19.261102511 9.382424132 [276] 16.134684894 5.489390044 -8.036066407 -1.472236774 -4.083356795 [281] -7.980805471 5.524969762 -2.282781442 -9.784467662 2.557304598 [286] -7.967522891 0.486371832 1.489636098 -1.433314293 -0.621862810 [291] -7.313773735 0.385422975 6.194622600 -8.842886522 -1.338122362 [296] -0.893999234 -0.491789423 -2.410153164 -6.332750697 5.439768127 [301] -1.149946665 -8.512508859 15.784432650 -3.380580884 -6.735326100 [306] 7.292569233 -7.796443994 2.397499850 -5.521682270 3.444735176 [311] -5.663050258 18.543141917 -15.865503730 7.165720679 5.157726268 [316] -9.995919833 3.772487164 0.173867991 -2.627503885 1.026288165 [321] -9.712338484 -0.092107341 10.275708140 -3.134071273 -2.792790559 [326] 9.119505593 -6.513647800 -5.225666349 -5.214532338 15.596369031 [331] -7.006714496 1.884900646 -3.831653093 -4.517930136 2.177497691 [336] 26.568494942 -23.556068965 16.265641444 16.972173903 -0.153217562 [341] 7.667191878 -11.801428363 19.859539224 -12.085913376 4.399752294 [346] -16.685517227 1.772771907 -0.048697818 -5.892478998 15.478648171 [351] -7.807127721 8.369575827 -22.533956192 9.669049702 1.112758191 [356] -3.453637165 -1.945712855 3.141320132 -5.852949781 > postscript(file="/var/www/html/rcomp/tmp/2gpmr1260462779.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/3fmum1260462779.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/4e5zr1260462779.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/595gf1260462779.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/6fl2g1260462779.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/7svss1260462779.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/8myla1260462779.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/923i01260462779.tab") > > system("convert tmp/1ubj81260462779.ps tmp/1ubj81260462779.png") > system("convert tmp/2gpmr1260462779.ps tmp/2gpmr1260462779.png") > system("convert tmp/3fmum1260462779.ps tmp/3fmum1260462779.png") > system("convert tmp/4e5zr1260462779.ps tmp/4e5zr1260462779.png") > system("convert tmp/595gf1260462779.ps tmp/595gf1260462779.png") > system("convert tmp/6fl2g1260462779.ps tmp/6fl2g1260462779.png") > system("convert tmp/7svss1260462779.ps tmp/7svss1260462779.png") > > > proc.time() user system elapsed 3.568 1.112 4.681