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(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,] 0.9761292 0.2761682 -0.30884876 -0.5319620 -0.63892405 0.1796001 [2,] 1.1888696 0.0000000 -0.23595301 -0.7578431 -0.46950070 0.2194032 [3,] -0.5756370 0.0000000 0.16377169 1.0460957 0.37751993 0.0000000 [4,] 0.0000000 0.0000000 0.09969094 0.4720773 0.10490568 0.0000000 [5,] 0.0000000 0.0000000 0.00000000 0.4680040 0.06221682 0.0000000 [6,] 0.0000000 0.0000000 0.00000000 0.4497582 0.00000000 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.04845 0.65051 0.07147 0.28094 0.08974 0.27599 [2,] 0.00000 NA 0.00176 0.00000 0.00000 0.06892 [3,] 0.37681 NA 0.08459 0.10950 0.23447 NA [4,] NA NA 0.09984 0.00000 0.08523 NA [5,] NA NA NA 0.00000 0.23123 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 0.9761 0.2762 -0.3088 -0.5320 -0.6389 0.1796 s.e. 0.4929 0.6090 0.1708 0.4926 0.3755 0.1646 sigma^2 estimated as 107.1: log likelihood = -1341.68, aic = 2697.37 [[3]][[2]] Call: arima(x = series, order = order, seasonal = seasonal, include.mean = include.mean, method = "ML") Coefficients: ar1 ar2 ar3 ma1 ma2 ma3 0.9761 0.2762 -0.3088 -0.5320 -0.6389 0.1796 s.e. 0.4929 0.6090 0.1708 0.4926 0.3755 0.1646 sigma^2 estimated as 107.1: log likelihood = -1341.68, aic = 2697.37 [[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.1889 0 -0.2360 -0.7578 -0.4695 0.2194 s.e. 0.0786 0 0.0749 0.1050 0.0656 0.1203 sigma^2 estimated as 105.6: log likelihood = -1341.76, aic = 2695.52 [[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.5756 0 0.1638 1.0461 0.3775 0 s.e. 0.6505 0 0.0947 0.6520 0.3170 0 sigma^2 estimated as 110.9: log likelihood = -1347.21, aic = 2704.42 [[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.0997 0.4721 0.1049 0 s.e. 0 0 0.0604 0.0527 0.0608 0 sigma^2 estimated as 111.0: log likelihood = -1347.38, aic = 2702.76 [[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.4680 0.0622 0 s.e. 0 0 0 0.0518 0.0519 0 sigma^2 estimated as 111.9: log likelihood = -1348.75, aic = 2703.5 $aic [1] 2697.367 2695.521 2704.417 2702.759 2703.495 2702.920 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 log(s2) : NaNs produced 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 > postscript(file="/var/www/html/rcomp/tmp/1kmcw1260452371.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 = 358 Frequency = 1 [1] 0.29989982 35.53822250 18.82921849 8.50040178 -9.43701476 [6] -3.61184781 -4.22252843 -3.99912242 -9.46568227 -0.62120975 [11] -4.72034668 -1.35220897 -1.67347578 -11.13267643 -0.08574408 [16] -7.86723171 -1.71276903 -13.60894304 -1.92439659 -2.65266947 [21] 0.46118987 -1.55079807 -3.60291400 -2.31733596 -5.69131555 [26] -0.69226404 -1.22192208 5.31493494 19.58861306 17.10177154 [31] 1.57756058 3.09767745 2.75212363 0.51926738 -12.31424761 [36] 11.33081050 -11.53671181 -0.60573921 3.00126591 -3.66691741 [41] 8.42940296 -6.81685073 -8.33413694 -1.57546745 -12.54415137 [46] -3.83126587 -0.72649489 -15.02162828 1.57538297 -2.10268767 [51] -1.71394899 2.03295759 -4.24479592 0.26009750 -0.75762898 [56] 0.73839099 -3.49843270 10.59134031 -6.53912873 13.80137918 [61] -4.95225747 1.75899861 -0.01510475 -1.90237021 -2.00874328 [66] 2.35845940 -2.37879092 -1.33345207 -0.12793823 0.64283876 [71] 1.40710877 0.90147202 -0.30943838 -4.01126831 1.49654206 [76] -1.25081938 -0.80772156 1.95583896 -3.06508667 2.31278688 [81] 1.50830633 -3.04978770 5.73347095 3.00646050 -3.96375400 [86] 2.66800049 0.29797715 3.19455099 0.88639803 -1.31359266 [91] 1.85961781 0.11141890 -1.26784400 1.58642399 -0.66357162 [96] 2.21185195 -0.59387034 -0.65968067 -0.45431805 0.75366592 [101] -0.02445247 -5.23544684 1.25173164 0.83991738 -1.57096349 [106] -7.11703972 23.72854372 73.23774518 -15.35187536 -4.17187980 [111] -0.99239854 -2.47599238 -6.07948167 -10.50072963 -14.30737007 [116] 5.64922903 1.84629703 -1.81555153 -2.36518527 -6.68012589 [121] -2.32651977 -7.89556316 -5.96009586 1.98058578 -3.55610395 [126] -8.15895472 7.93967327 3.19182502 -13.98776823 3.24774689 [131] 9.45031577 -4.32485047 -5.06392108 10.33901398 -6.32363928 [136] 0.81622819 6.21143863 -7.25776151 3.91020578 0.12156272 [141] 3.39982759 1.70130370 2.89225653 7.34056254 -4.91535995 [146] 9.44370188 0.68612740 -0.50866749 5.99536978 -8.17420962 [151] -3.84744968 -3.69080467 -11.53331241 9.02726696 -5.50723143 [156] 6.81575874 -10.24716023 3.77165759 4.17239471 1.71264187 [161] 6.63888355 -5.91357947 2.15452889 -0.14040413 -8.56833824 [166] 3.61875243 -0.76049602 2.73076795 -8.93069480 7.00970158 [171] -7.22492926 1.64517477 -6.42043633 -5.19756738 -0.36805833 [176] 1.89562889 -4.16426257 -2.96904828 5.94861377 -0.59925056 [181] -5.78965214 0.84686407 4.76387793 -5.78220332 5.10970120 [186] -5.93161052 -5.14189165 -1.72452798 -8.97300179 1.60669576 [191] -1.39366848 10.55227899 -3.85179961 2.64612856 2.70124786 [196] 0.47117138 1.11142684 -5.34946704 1.73442276 -8.27889004 [201] 5.56664374 2.60987442 3.43222935 -1.86867530 -0.73899480 [206] 0.56211559 1.68290554 5.47742036 71.63184010 80.03522155 [211] -44.11351251 14.86576531 -1.01263585 -10.45098296 6.55410526 [216] -18.81712085 -4.20128695 0.73696068 -1.78350987 -0.01116152 [221] -3.08381205 3.84393094 -7.10711025 -10.01300083 0.02830666 [226] -5.59027057 -14.88549192 8.61427925 -7.10538956 0.48939799 [231] -8.08696550 3.15428377 -6.77307229 3.97357571 -7.13825049 [236] 4.19350685 -7.61845892 5.70456292 -2.89576223 2.60030867 [241] 18.56321014 29.35055967 6.60887552 26.98092108 6.96163664 [246] -0.83674118 -5.24153263 -19.99488216 0.78379718 -13.32280228 [251] -7.41364003 -0.90148411 6.88315131 -10.56525517 -3.58366564 [256] -6.86549342 1.93604296 -7.17892677 -5.16068768 -8.83812731 [261] 2.35736089 -4.15337426 0.69712845 -0.76784920 5.11598341 [266] -3.34652779 4.14788832 -9.13301819 3.91622102 -0.46457993 [271] -3.52622953 10.57919436 -19.23171495 9.34231653 16.12429422 [276] 5.57251590 -8.01116226 -1.49744788 -4.10075930 -7.98766162 [281] 5.49339413 -2.27396377 -9.77755727 2.51741513 -7.96983195 [286] 0.47328801 1.47435689 -1.41945146 -0.62742077 -7.31805079 [291] 0.36391348 6.18499286 -8.81724320 -1.35830511 -0.91572689 [296] -0.48692669 -2.41514273 -6.33940841 5.41713126 -1.14082151 [301] -8.50312760 15.75047638 -3.34224908 -6.71575846 7.25094622 [306] -7.77563902 2.38789969 -5.53377118 3.44125976 -5.66622984 [311] 18.53771424 -15.82319042 7.15195948 5.13732262 -9.94925993 [316] 3.73666600 0.17023651 -2.61215485 1.01190746 -9.71105682 [321] -0.11814381 10.25948285 -3.09412892 -2.79024754 9.09835399 [326] -6.48446613 -5.23131428 -5.24828091 15.58169242 -6.96576371 [331] 1.89056224 -3.85140311 -4.51515254 2.15273169 26.57343129 [336] -23.47040940 16.23093213 16.96411235 -0.04911014 7.66753063 [341] -11.78537986 19.83855606 -12.05127560 4.40575385 -16.71211858 [346] 1.74722708 -0.07793448 -5.87223326 15.45307774 -7.76675119 [351] 8.37342962 -22.53557636 9.62577270 1.09719134 -3.41237494 [356] -1.97125849 3.13486406 -5.84448362 > postscript(file="/var/www/html/rcomp/tmp/27c9x1260452371.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/3wn5m1260452371.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/48vyj1260452371.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/5wuvc1260452371.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/6dx2b1260452371.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/7ws8l1260452371.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/8appp1260452371.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/9axcz1260452371.tab") > system("convert tmp/1kmcw1260452371.ps tmp/1kmcw1260452371.png") > system("convert tmp/27c9x1260452371.ps tmp/27c9x1260452371.png") > system("convert tmp/3wn5m1260452371.ps tmp/3wn5m1260452371.png") > system("convert tmp/48vyj1260452371.ps tmp/48vyj1260452371.png") > system("convert tmp/5wuvc1260452371.ps tmp/5wuvc1260452371.png") > system("convert tmp/6dx2b1260452371.ps tmp/6dx2b1260452371.png") > system("convert tmp/7ws8l1260452371.ps tmp/7ws8l1260452371.png") > > > proc.time() user system elapsed 3.158 1.133 4.005