Home » date » 2010 » Dec » 14 »

*The author of this computation has been verified*
R Software Module: /rwasp_arimabackwardselection.wasp (opens new window with default values)
Title produced by software: ARIMA Backward Selection
Date of computation: Tue, 14 Dec 2010 15:33:03 +0000
 
Cite this page as follows:
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL http://www.freestatistics.org/blog/date/2010/Dec/14/t1292340660i7d16r3s6jcjr4i.htm/, Retrieved Tue, 14 Dec 2010 16:33:10 +0100
 
BibTeX entries for LaTeX users:
@Manual{KEY,
    author = {{YOUR NAME}},
    publisher = {Office for Research Development and Education},
    title = {Statistical Computations at FreeStatistics.org, URL http://www.freestatistics.org/blog/date/2010/Dec/14/t1292340660i7d16r3s6jcjr4i.htm/},
    year = {2010},
}
@Manual{R,
    title = {R: A Language and Environment for Statistical Computing},
    author = {{R Development Core Team}},
    organization = {R Foundation for Statistical Computing},
    address = {Vienna, Austria},
    year = {2010},
    note = {{ISBN} 3-900051-07-0},
    url = {http://www.R-project.org},
}
 
Original text written by user:
 
IsPrivate?
No (this computation is public)
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
1145.11 1176.86 1206.41 1192.72 1214.82 1199.07 1157.47 1100.1 1095.63 1105.63 1137.79 1124.72 1152.6 1211.85 1239.62 1244.13 1198.42 1227.99 1304.92 1340.26 1307.32 1356.51 1383.29 1437.87 1494.56 1521.42 1498.76 1488.75 1524.62 1439.27 1423.11 1466.85 1425.83 1363.45 1389.18 1395.89 1368.43 1349.03 1299.88 1365.41 1451.04 1433.75 1464.65 1475.57 1471.16 1429.12 1452.46 1538.09 1631.59 1665.5 1690.6 1711.74 1734.1 1748.09 1703.45 1745.74 1751.01 1795.65 1852.13 1877.1 1989.31 2097.76 2154.87 2152.18 2250.27 2346.9 2525.56 2409.36 2394.36 2401.33 2354.32 2450.41 2504.67 2661.39 2880.4 3064.42 3141.12 3327.7 3564.95 3403.13 3149.9 3006.84 3230.66 3361.13 3484.74 3411.13 3288.18 3280.37 3173.95 3165.26 3092.71 3053.05 3181.96 2999.93 3249.57 3210.52 3030.29 2803.47 2767.63 2882.6 2863.36 2897.06 3012.61 3142.95 3032.93 3045.78 3110.52 3013.24 2987.1 2995.55 2833.18 2848.96 2794.83 2845.26 2915.02 2 etc...
 
Output produced by software:


Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time9 seconds
R Server'George Udny Yule' @ 72.249.76.132


ARIMA Parameter Estimation and Backward Selection
Iterationar1ar2ar3ma1sar1sar2sma1
Estimates ( 1 )-0.49130.38290.41740.29350.1948-0.4710.2935
(p-val)(0.0186 )(0 )(0 )(0.808 )(0.2089 )(0 )(0.808 )
Estimates ( 2 )-0.58860.45090.413500.1785-0.43050.707
(p-val)(0.0013 )(0 )(0 )(NA )(0.1632 )(0 )(0.0063 )
Estimates ( 3 )-0.57180.50290.31900-0.34650.8551
(p-val)(0 )(0 )(4e-04 )(NA )(NA )(4e-04 )(0 )
Estimates ( 4 )NANANANANANANA
(p-val)(NA )(NA )(NA )(NA )(NA )(NA )(NA )
Estimates ( 5 )NANANANANANANA
(p-val)(NA )(NA )(NA )(NA )(NA )(NA )(NA )
Estimates ( 6 )NANANANANANANA
(p-val)(NA )(NA )(NA )(NA )(NA )(NA )(NA )
Estimates ( 7 )NANANANANANANA
(p-val)(NA )(NA )(NA )(NA )(NA )(NA )(NA )
Estimates ( 8 )NANANANANANANA
(p-val)(NA )(NA )(NA )(NA )(NA )(NA )(NA )
Estimates ( 9 )NANANANANANANA
(p-val)(NA )(NA )(NA )(NA )(NA )(NA )(NA )
Estimates ( 10 )NANANANANANANA
(p-val)(NA )(NA )(NA )(NA )(NA )(NA )(NA )
Estimates ( 11 )NANANANANANANA
(p-val)(NA )(NA )(NA )(NA )(NA )(NA )(NA )
Estimates ( 12 )NANANANANANANA
(p-val)(NA )(NA )(NA )(NA )(NA )(NA )(NA )
Estimates ( 13 )NANANANANANANA
(p-val)(NA )(NA )(NA )(NA )(NA )(NA )(NA )


Estimated ARIMA Residuals
Value
1.14510934051474
29.5831519191089
19.877488750705
-21.0773250189315
23.2601215783404
-28.2180766336424
-39.0072041830626
-50.2705342734260
13.6433222105837
7.00796559363794
44.2330742870726
-17.7278907581283
40.9633800910056
40.3928917555035
15.4074887572086
-8.8039933848595
-46.8708733392805
29.0914821367792
59.9781355327506
18.9331045452236
-39.1476025921752
57.3706927041309
-6.80897993597703
48.8849886538227
34.901689756515
16.396695907082
-46.6792310267876
-5.5231479611548
19.8369657383799
-94.9237543148447
10.1893124083478
42.9969137998007
-47.1813347522284
-46.1646775246676
51.582935942008
-10.4938437145402
-18.3966974245396
-5.74297021644041
-42.1257666878921
74.3921106056191
69.7321153115764
-28.55562666021
37.3942486737373
-6.63536974001851
-19.7045551719977
-46.9143703249648
38.3111043348601
66.9289172724648
80.3084178078253
8.71349923214574
18.9633196796815
-8.1371792206055
4.4399844856639
-5.35552484742561
-48.662805603625
47.8382303781107
-13.1744664197395
48.7045829057433
39.1998065064747
17.2565981910534
91.4421190107085
75.8754114823905
17.1314938897995
-26.9921682228683
82.3159105527925
41.4256434429508
150.732233364553
-179.284912860423
22.6570839440115
-43.9463083213059
-40.6272199492732
88.0293563240757
59.2632168336145
130.595391564722
180.896633539073
118.763249884595
4.5955479266031
145.725292741571
132.204427252000
-248.637832764873
-230.435959544483
-118.699009050447
231.994996831003
73.6120609540522
167.658547809545
-113.379844176488
-100.347420936341
-43.4410732864271
-95.7073895430194
12.9632372671422
-43.4098288339701
-6.3227395644999
141.102881275581
-198.172687401915
312.354829668964
-127.254447499231
-131.536277150492
-223.791190918921
57.4624117335011
62.7347276658115
34.7671795456945
49.0256845529561
132.645655834529
73.8035824987219
-144.082816597475
43.4000544736723
22.8428831730043
-115.968061985014
-3.16234016280714
25.0502579329532
-175.654462318769
74.578496058326
-60.2232725323579
85.40941360748
53.6186713580992
-6.69648046838029
-301.729857195751
133.172448828607
-40.1422045540739
23.1279957908168
90.0480375982575
43.5288755721663
-47.8134077403024
95.2252006933773
-55.2332768561018
-236.487243644851
-191.089348288010
-33.2956347537156
-123.702915650186
-36.2225982616903
175.184857984655
-45.8547856841988
-4.04554827152742
-158.583296216273
-72.8162089447185
210.181528657962
54.6419202333277
58.1446859857674
11.4730954103736
74.8726516068173
-32.9235778410969
31.8855218756626
21.0709520610294
10.4715767544326
126.283725423292
47.5050374010816
-60.7542342093757
58.4141336410376
-105.820290420611
51.392634981165
-32.7388896769062
67.4484290206938
114.030403141996
91.3431354922036
43.4066313467552
48.8749573609512
8.3446958828872
61.497924893255
-21.5907602177031
-3.48374974071794
-81.4203528852245
43.4910756159616
33.9980285157672
91.8017870758004
-12.2005074939002
23.9613015460604
34.97542635321
106.790636991715
121.288494198168
103.625198316313
47.9371241993072
-73.3085253350491
-120.598800135265
-238.293626969748
180.281065207151
107.662815883300
114.869327083717
145.379211571178
26.4722584637875
25.0733669427573
109.991172897771
-12.0497494565843
-176.867744069596
258.167575110294
-1.78355845331316
-83.0451232641126
-55.7088432698911
-346.147267222352
149.877567942319
111.472252539601
-314.534133374292
127.383238927835
-274.341245231075
-49.7264073864894
-13.8344115667983
268.464417687361
-124.838486916581
-187.59369277682
-440.737459872609
160.544166579793
-135.236742261389
-622.084792331595
61.9433997319716
-85.6862983151102
132.555559881305
-29.9928368703957
6.45548746267627
191.346273053471
179.089969617082
-81.4858049865329
84.3707146368966
169.403196535344
60.8251686973995
26.444766474242
-73.7972539004536
14.1159884907506
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2010/Dec/14/t1292340660i7d16r3s6jcjr4i/1qfiv1292340773.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/14/t1292340660i7d16r3s6jcjr4i/1qfiv1292340773.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/14/t1292340660i7d16r3s6jcjr4i/2qfiv1292340773.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/14/t1292340660i7d16r3s6jcjr4i/2qfiv1292340773.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/14/t1292340660i7d16r3s6jcjr4i/3qfiv1292340773.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/14/t1292340660i7d16r3s6jcjr4i/3qfiv1292340773.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/14/t1292340660i7d16r3s6jcjr4i/4160g1292340773.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/14/t1292340660i7d16r3s6jcjr4i/4160g1292340773.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/14/t1292340660i7d16r3s6jcjr4i/5160g1292340773.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/14/t1292340660i7d16r3s6jcjr4i/5160g1292340773.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/14/t1292340660i7d16r3s6jcjr4i/6160g1292340773.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/14/t1292340660i7d16r3s6jcjr4i/6160g1292340773.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/14/t1292340660i7d16r3s6jcjr4i/7160g1292340773.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/14/t1292340660i7d16r3s6jcjr4i/7160g1292340773.ps (open in new window)


 
Parameters (Session):
par1 = FALSE ; par2 = 1 ; par3 = 1 ; par4 = 0 ; par5 = 1 ; par6 = 3 ; par7 = 1 ; par8 = 2 ; par9 = 1 ;
 
Parameters (R input):
par1 = FALSE ; par2 = 1 ; par3 = 1 ; par4 = 0 ; par5 = 1 ; par6 = 3 ; par7 = 1 ; par8 = 2 ; par9 = 1 ;
 
R code (references can be found in the software module):
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
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(par6,par3,par7), seasonal=list(order=c(par8,par4,par9), period=par5)))
bitmap(file='test1.png')
resid <- arimaSelectplot(selection)
dev.off()
resid
bitmap(file='test2.png')
acf(resid,length(resid)/2, main='Residual Autocorrelation Function')
dev.off()
bitmap(file='test3.png')
pacf(resid,length(resid)/2, main='Residual Partial Autocorrelation Function')
dev.off()
bitmap(file='test4.png')
cpgram(resid, main='Residual Cumulative Periodogram')
dev.off()
bitmap(file='test5.png')
hist(resid, main='Residual Histogram', xlab='values of Residuals')
dev.off()
bitmap(file='test6.png')
densityplot(~resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
dev.off()
bitmap(file='test7.png')
qqnorm(resid, main='Residual Normal Q-Q Plot')
qqline(resid)
dev.off()
ncols <- length(selection[[1]][1,])
nrows <- length(selection[[2]][,1])-1
load(file='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='mytable.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='mytable1.tab')
 





Copyright

Creative Commons License

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.

Software written by Ed van Stee & Patrick Wessa


Disclaimer

Information provided on this web site is provided "AS IS" without warranty of any kind, either express or implied, including, without limitation, warranties of merchantability, fitness for a particular purpose, and noninfringement. We use reasonable efforts to include accurate and timely information and periodically update the information, and software without notice. However, we make no warranties or representations as to the accuracy or completeness of such information (or software), and we assume no liability or responsibility for errors or omissions in the content of this web site, or any software bugs in online applications. Your use of this web site is AT YOUR OWN RISK. Under no circumstances and under no legal theory shall we be liable to you or any other person for any direct, indirect, special, incidental, exemplary, or consequential damages arising from your access to, or use of, this web site.


Privacy Policy

We may request personal information to be submitted to our servers in order to be able to:

  • personalize online software applications according to your needs
  • enforce strict security rules with respect to the data that you upload (e.g. statistical data)
  • manage user sessions of online applications
  • alert you about important changes or upgrades in resources or applications

We NEVER allow other companies to directly offer registered users information about their products and services. Banner references and hyperlinks of third parties NEVER contain any personal data of the visitor.

We do NOT sell, nor transmit by any means, personal information, nor statistical data series uploaded by you to third parties.

We carefully protect your data from loss, misuse, alteration, and destruction. However, at any time, and under any circumstance you are solely responsible for managing your passwords, and keeping them secret.

We store a unique ANONYMOUS USER ID in the form of a small 'Cookie' on your computer. This allows us to track your progress when using this website which is necessary to create state-dependent features. The cookie is used for NO OTHER PURPOSE. At any time you may opt to disallow cookies from this website - this will not affect other features of this website.

We examine cookies that are used by third-parties (banner and online ads) very closely: abuse from third-parties automatically results in termination of the advertising contract without refund. We have very good reason to believe that the cookies that are produced by third parties (banner ads) do NOT cause any privacy or security risk.

FreeStatistics.org is safe. There is no need to download any software to use the applications and services contained in this website. Hence, your system's security is not compromised by their use, and your personal data - other than data you submit in the account application form, and the user-agent information that is transmitted by your browser - is never transmitted to our servers.

As a general rule, we do not log on-line behavior of individuals (other than normal logging of webserver 'hits'). However, in cases of abuse, hacking, unauthorized access, Denial of Service attacks, illegal copying, hotlinking, non-compliance with international webstandards (such as robots.txt), or any other harmful behavior, our system engineers are empowered to log, track, identify, publish, and ban misbehaving individuals - even if this leads to ban entire blocks of IP addresses, or disclosing user's identity.


FreeStatistics.org is powered by