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(87.28 + ,87.28 + ,87.09 + ,86.92 + ,87.59 + ,90.72 + ,90.69 + ,90.3 + ,89.55 + ,88.94 + ,88.41 + ,87.82 + ,87.07 + ,86.82 + ,86.4 + ,86.02 + ,85.66 + ,85.32 + ,85 + ,84.67 + ,83.94 + ,82.83 + ,81.95 + ,81.19 + ,80.48 + ,78.86 + ,69.47 + ,68.77 + ,70.06 + ,73.95 + ,75.8 + ,77.79 + ,81.57 + ,83.07 + ,84.34 + ,85.1 + ,85.25 + ,84.26 + ,83.63 + ,86.44 + ,85.3 + ,84.1 + ,83.36 + ,82.48 + ,81.58 + ,80.47 + ,79.34 + ,82.13 + ,81.69 + ,80.7 + ,79.88 + ,79.16 + ,78.38 + ,77.42 + ,76.47 + ,75.46 + ,74.48 + ,78.27 + ,80.7 + ,79.91 + ,78.75 + ,77.78 + ,81.14 + ,81.08 + ,80.03 + ,78.91 + ,78.01 + ,76.9 + ,75.97 + ,81.93 + ,80.27 + ,78.67 + ,77.42 + ,76.16 + ,74.7 + ,76.39 + ,76.04 + ,74.65 + ,73.29 + ,71.79 + ,74.39 + ,74.91 + ,74.54 + ,73.08 + ,72.75 + ,71.32 + ,70.38 + ,70.35 + ,70.01 + ,69.36 + ,67.77 + ,69.26 + ,69.8 + ,68.38 + ,67.62 + ,68.39 + ,66.95 + ,65.21 + ,66.64 + ,63.45 + ,60.66 + ,62.34 + ,60.32 + ,58.64 + ,60.46 + ,58.59 + ,61.87 + ,61.85 + ,67.44 + ,77.06 + ,91.74 + ,93.15 + ,94.15 + ,93.11 + ,91.51 + ,89.96 + ,88.16 + ,86.98 + ,88.03 + ,86.24 + ,84.65 + ,83.23 + ,81.7 + ,80.25 + ,78.8 + ,77.51 + ,76.2 + ,75.04 + ,74 + ,75.49 + ,77.14 + ,76.15 + ,76.27 + ,78.19 + ,76.49 + ,77.31 + ,76.65 + ,74.99 + ,73.51 + ,72.07 + ,70.59 + ,71.96 + ,76.29 + ,74.86 + ,74.93 + ,71.9 + ,71.01 + ,77.47 + ,75.78 + ,76.6 + ,76.07 + ,74.57 + ,73.02 + ,72.65 + ,73.16 + ,71.53 + ,69.78 + ,67.98 + ,69.96 + ,72.16 + ,70.47 + ,68.86 + ,67.37 + ,65.87 + ,72.16 + ,71.34 + ,69.93 + ,68.44 + ,67.16 + ,66.01 + ,67.25 + ,70.91 + ,69.75 + ,68.59 + ,67.48 + ,66.31 + ,64.81 + ,66.58 + ,65.97 + ,64.7 + ,64.7 + ,60.94 + ,59.08 + ,58.42 + ,57.77 + ,57.11 + ,53.31 + ,49.96 + ,49.4 + ,48.84 + ,48.3 + ,47.74 + ,47.24 + ,46.76 + ,46.29 + ,48.9 + ,49.23 + ,48.53 + ,48.03 + ,54.34 + ,53.79 + ,53.24 + ,52.96 + ,52.17 + ,51.7 + ,58.55 + ,78.2 + ,77.03 + ,76.19 + ,77.15 + ,75.87 + ,95.47 + ,109.67 + ,112.28 + ,112.01 + ,107.93 + ,105.96 + ,105.06 + ,102.98 + ,102.2 + ,105.23 + ,101.85 + ,99.89 + ,96.23 + ,94.76 + ,91.51 + ,91.63 + ,91.54 + ,85.23 + ,87.83 + ,87.38 + ,84.44 + ,85.19 + ,84.03 + ,86.73 + ,102.52 + ,104.45 + ,106.98 + ,107.02 + ,99.26 + ,94.45 + ,113.44 + ,157.33 + ,147.38 + ,171.89 + ,171.95 + ,132.71 + ,126.02 + ,121.18 + ,115.45 + ,110.48 + ,117.85 + ,117.63 + ,124.65 + ,109.59 + ,111.27 + ,99.78 + ,98.21 + ,99.2 + ,97.97 + ,89.55 + ,87.91 + ,93.34 + ,94.42 + ,93.2 + ,90.29 + ,91.46 + ,89.98 + ,88.35 + ,88.41 + ,82.44 + ,79.89 + ,75.69 + ,75.66 + ,84.5 + ,96.73 + ,87.48 + ,82.39 + ,83.48 + ,79.31 + ,78.16 + ,72.77 + ,72.45 + ,68.46 + ,67.62 + ,68.76 + ,70.07 + ,68.55 + ,65.3 + ,58.96 + ,59.17 + ,62.37 + ,66.28 + ,55.62 + ,55.23 + ,55.85 + ,56.75 + ,50.89 + ,53.88 + ,52.95 + ,55.08 + ,53.61 + ,58.78 + ,61.85 + ,55.91 + ,53.32 + ,46.41 + ,44.57 + ,50 + ,50 + ,53.36 + ,46.23 + ,50.45 + ,49.07 + ,45.85 + ,48.45 + ,49.96 + ,46.53 + ,50.51 + ,47.58 + ,48.05 + ,46.84 + ,47.67 + ,49.16 + ,55.54 + ,55.82 + ,58.22 + ,56.19 + ,57.77 + ,63.19 + ,54.76 + ,55.74 + ,62.54 + ,61.39 + ,69.6 + ,79.23 + ,80 + ,93.68 + ,107.63 + ,100.18 + ,97.3 + ,90.45 + ,80.64 + ,80.58 + ,75.82 + ,85.59 + ,89.35 + ,89.42 + ,104.73 + ,95.32 + ,89.27 + ,90.44 + ,86.97 + ,79.98 + ,81.22 + ,87.35 + ,83.64 + ,82.22 + ,94.4) > 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,] -0.2829357 -0.4571699 -0.3489512 0.4281146 0.5829760 0.6241419 [2,] 0.0000000 -0.5011534 -0.5530316 0.1593749 0.5506812 0.7546503 [3,] NA NA NA NA NA NA [4,] NA NA NA NA NA NA [5,] NA NA NA NA NA NA [6,] NA NA NA NA 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 [[2]] [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0.0544 0.00021 0.01373 0.00064 0 0 [2,] NA 0.00000 0.00000 0.00009 0 0 [3,] NA NA NA NA NA NA [4,] NA NA NA NA NA NA [5,] NA NA NA NA NA NA [6,] NA NA NA NA 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 -0.2829 -0.4572 -0.3490 0.4281 0.5830 0.6241 s.e. 0.1466 0.1222 0.1409 0.1243 0.0955 0.1202 sigma^2 estimated as 26.72: log likelihood = -1096.33, aic = 2206.66 [[3]][[2]] Call: arima(x = series, order = order, seasonal = seasonal, include.mean = include.mean, method = "ML") Coefficients: ar1 ar2 ar3 ma1 ma2 ma3 -0.2829 -0.4572 -0.3490 0.4281 0.5830 0.6241 s.e. 0.1466 0.1222 0.1409 0.1243 0.0955 0.1202 sigma^2 estimated as 26.72: log likelihood = -1096.33, aic = 2206.66 [[3]][[3]] NULL [[3]][[4]] NULL [[3]][[5]] NULL [[3]][[6]] NULL $aic [1] 2206.656 2206.436 Warning message: 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/10u271260460704.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] 8.727995e-02 -1.314805e-05 -1.832806e-01 -1.390005e-01 6.790666e-01 [6] 3.018813e+00 -5.143447e-01 -6.365760e-01 -1.059639e+00 1.317967e-01 [11] -2.324869e-01 -5.968321e-01 -1.057436e+00 2.822302e-02 -6.799233e-02 [16] -2.038818e-01 -6.359332e-01 -3.277948e-01 -7.599941e-02 -8.200243e-02 [21] -8.038721e-01 -1.138439e+00 -6.355252e-01 -3.343370e-01 -4.909687e-01 [26] -1.673277e+00 -9.224390e+00 8.870486e-01 2.273328e+00 4.922837e+00 [31] -6.905172e-01 7.496899e-01 3.555336e+00 2.596297e+00 4.649710e-01 [36] -8.072050e-01 -7.670278e-02 5.625944e-02 -5.191353e-02 2.268745e+00 [41] -1.954553e+00 -9.110893e-01 -5.066350e-01 -6.785369e-02 -1.012981e+00 [46] -1.235721e+00 -1.000658e+00 3.429774e+00 -6.682844e-01 -1.322106e+00 [51] -1.512727e+00 2.773340e-01 -1.157277e-01 -9.639707e-01 -1.522391e+00 [56] -7.038925e-01 -2.445530e-01 4.184710e+00 1.492217e+00 -1.637551e+00 [61] -1.730787e+00 -4.714455e-02 4.330817e+00 -7.039205e-01 -2.063345e+00 [66] -1.681363e+00 6.441892e-01 -2.508443e-01 -1.265085e+00 5.161127e+00 [71] -2.101685e+00 -9.889237e-01 -1.954521e+00 -1.993731e-01 -1.104261e+00 [76] 2.073569e+00 -1.098516e+00 -1.275214e+00 -1.431418e+00 -6.005319e-01 [81] 2.956296e+00 7.317420e-02 -9.376182e-01 -1.906084e+00 5.861759e-01 [86] -8.744912e-01 -7.826100e-01 -5.858691e-01 -2.435931e-02 -2.474914e-01 [91] -1.453993e+00 1.406290e+00 4.079158e-01 -1.227833e+00 -9.848355e-01 [96] 9.770439e-01 -1.142908e+00 -1.526230e+00 1.257935e+00 -3.018815e+00 [101] -2.134350e+00 1.819751e+00 -1.583944e+00 -1.507683e+00 1.440503e+00 [106] -1.577135e+00 3.773146e+00 -9.067724e-01 5.604225e+00 8.111425e+00 [111] 1.377665e+01 -2.212475e+00 -6.798389e-01 -2.007566e+00 1.691634e+00 [116] -1.258737e+00 -2.527224e+00 -2.196284e+00 2.551559e+00 -8.951225e-01 [121] -1.761679e+00 -2.638303e+00 -5.680957e-01 -2.060907e-01 -9.891457e-01 [126] -1.998862e+00 -1.282842e+00 -2.945144e-01 -2.957190e-01 1.307276e+00 [131] 9.878861e-01 -1.205351e+00 2.383499e-01 2.061192e+00 -1.716434e+00 [136] 6.430904e-01 -1.096348e+00 -8.993207e-01 -1.342488e+00 -1.064657e+00 [141] -1.343561e+00 1.810253e+00 4.211285e+00 -2.114688e+00 -5.565936e-01 [146] -3.310330e+00 8.472534e-01 6.761904e+00 -2.649121e+00 -3.521170e-01 [151] -1.341652e+00 5.682802e-01 -1.171931e+00 -6.714411e-01 -2.107525e-01 [156] -9.826186e-01 -1.144529e+00 -1.667987e+00 2.096494e+00 2.115848e+00 [161] -1.877428e+00 -2.129708e+00 -1.264786e+00 -2.925220e-01 6.814415e+00 [166] -2.203438e+00 -2.136576e+00 -2.122826e+00 8.973201e-01 -4.984344e-01 [171] 8.247248e-01 2.415881e+00 -1.162833e+00 -8.075840e-01 -1.175571e+00 [176] -7.193047e-01 -1.245955e+00 2.109844e+00 -9.311765e-01 -1.210512e+00 [181] -2.763088e-01 -3.148288e+00 -1.102565e+00 -4.253625e-01 -2.092785e-01 [186] -7.689611e-01 -3.797511e+00 -2.749030e+00 3.953111e-01 2.275887e-01 [191] -7.355515e-01 -1.228722e+00 -2.879334e-01 2.327557e-01 -1.946979e-01 [196] 2.210476e+00 -2.920099e-01 -6.195468e-01 -5.806055e-01 6.755669e+00 [201] -1.404563e+00 -9.700471e-01 -1.467554e+00 7.578539e-01 1.230978e-01 [206] 6.679601e+00 1.769316e+01 -4.188286e+00 -2.487972e+00 -4.918999e-01 [211] 2.474425e+00 2.016388e+01 9.727387e+00 -2.322330e+00 -3.462016e+00 [216] -1.243340e+00 1.662977e+00 -1.243171e+00 -4.320223e+00 -9.310366e-01 [221] 5.237433e+00 -2.608134e+00 -3.158899e+00 -5.098517e+00 1.071105e+00 [226] -1.537743e+00 4.673580e-01 -2.026945e+00 -5.859619e+00 4.213956e+00 [231] 2.465476e-01 -2.985513e+00 -8.759801e-01 -4.872838e-01 4.271428e+00 [236] 1.528747e+01 -1.503667e+00 3.024813e-01 -1.646343e+00 -4.451582e+00 [241] -3.427674e+00 1.918555e+01 4.091915e+01 -1.709220e+01 1.987459e+01 [246] -6.322236e+00 -2.970166e+01 -5.215309e+00 -1.157171e+00 -1.776867e+00 [251] -6.448009e+00 6.173899e+00 -1.814735e-01 9.095738e+00 -1.824421e+01 [256] 3.172834e+00 -1.184944e+01 5.302118e+00 -1.463127e+00 -7.459898e-01 [261] -1.100020e+01 1.818265e+00 6.787437e+00 1.828295e+00 -4.878765e+00 [266] -4.080138e+00 3.615632e+00 9.707093e-01 -2.506120e+00 -2.419184e+00 [271] -5.323822e+00 4.732213e-01 -3.218871e+00 -4.236201e-02 7.620876e+00 [276] 1.202296e+01 -1.132234e+01 -5.949587e+00 1.332431e+00 5.483849e-01 [281] -9.058487e-01 -8.004932e+00 -2.130485e-01 -1.622708e+00 1.819066e+00 [286] -7.332346e-01 1.224456e-01 -1.681617e+00 -1.577181e+00 -5.918180e+00 [291] 9.026655e-01 3.274965e+00 4.464541e+00 -1.240145e+01 1.605630e-01 [296] 1.375125e+00 4.235254e+00 -8.173057e+00 2.131480e+00 -1.240203e+00 [301] 5.578448e+00 -3.244704e+00 4.314398e+00 1.166788e+00 -4.210331e+00 [306] -2.633551e+00 -6.433370e+00 -1.345647e-01 6.298390e+00 -3.187533e-01 [311] 1.749003e+00 -8.778568e+00 6.676314e+00 -1.105315e+00 -2.109073e+00 [316] -8.904299e-02 2.249526e+00 -2.532532e+00 4.435500e+00 -4.671613e+00 [321] 1.258487e+00 -1.611422e+00 2.552045e+00 3.970459e-01 6.106788e+00 [326] -1.382770e+00 2.699963e+00 -3.157913e+00 2.841534e+00 4.715791e+00 [331] -8.586991e+00 7.775586e-01 6.844453e+00 2.563231e-01 6.750157e+00 [336] 6.488844e+00 -2.638882e-02 1.318070e+01 1.185556e+01 -9.723368e+00 [341] -4.812113e+00 -5.873825e+00 -4.275667e+00 1.286024e+00 -6.043983e+00 [346] 9.479004e+00 2.989951e+00 9.056091e-01 1.241100e+01 -1.144163e+01 [351] -4.590942e+00 1.388133e+00 3.485522e-02 -7.506824e+00 4.112422e-01 [356] 6.252847e+00 -2.079239e+00 -2.246321e+00 1.049237e+01 > postscript(file="/var/www/html/rcomp/tmp/2gg3u1260460704.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/3j9on1260460704.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/4ekaj1260460704.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/577ks1260460704.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/6li761260460704.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/7uxda1260460704.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/8bd1n1260460705.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/971fz1260460705.tab") > system("convert tmp/10u271260460704.ps tmp/10u271260460704.png") > system("convert tmp/2gg3u1260460704.ps tmp/2gg3u1260460704.png") > system("convert tmp/3j9on1260460704.ps tmp/3j9on1260460704.png") > system("convert tmp/4ekaj1260460704.ps tmp/4ekaj1260460704.png") > system("convert tmp/577ks1260460704.ps tmp/577ks1260460704.png") > system("convert tmp/6li761260460704.ps tmp/6li761260460704.png") > system("convert tmp/7uxda1260460704.ps tmp/7uxda1260460704.png") > > > proc.time() user system elapsed 2.232 1.130 6.063