Home » date » 2009 » Dec » 11 »

workshop 10

*The author of this computation has been verified*
R Software Module: /rwasp_arimaforecasting.wasp (opens new window with default values)
Title produced by software: ARIMA Forecasting
Date of computation: Fri, 11 Dec 2009 07:50:25 -0700
 
Cite this page as follows:
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL http://www.freestatistics.org/blog/date/2009/Dec/11/t1260543090s4ncy1x3vkhi28s.htm/, Retrieved Fri, 11 Dec 2009 15:51:32 +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/2009/Dec/11/t1260543090s4ncy1x3vkhi28s.htm/},
    year = {2009},
}
@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 = {2009},
    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 «
6.9 6.8 6.7 6.6 6.5 6.5 7.0 7.5 7.6 7.6 7.6 7.8 8.0 8.0 8.0 7.9 7.9 8.0 8.5 9.2 9.4 9.5 9.5 9.6 9.7 9.7 9.6 9.5 9.4 9.3 9.6 10.2 10.2 10.1 9.9 9.8 9.8 9.7 9.5 9.3 9.1 9.0 9.5 10.0 10.2 10.1 10.0 9.9 10.0 9.9 9.7 9.5 9.2 9.0 9.3 9.8 9.8 9.6 9.4 9.3 9.2 9.2 9.0 8.8 8.7 8.7 9.1 9.7 9.8 9.6 9.4 9.4 9.5 9.4 9.3 9.2 9.0 8.9 9.2 9.8 9.9 9.6 9.2 9.1 9.1 9.0 8.9 8.7 8.5 8.3 8.5 8.7 8.4 8.1 7.8 7.7 7.5 7.2 6.8 6.7 6.4 6.3 6.8 7.3 7.1 7.0 6.8 6.6 6.3 6.1 6.1 6.3 6.3 6.0 6.2 6.4 6.8 7.5 7.5 7.6 7.6 7.4 7.3 7.1 6.9 6.8 7.5 7.6 7.8 8.0 8.1 8.2 8.3 8.2 8.0 7.9 7.6 7.6 8.3 8.4 8.4 8.4 8.4 8.6 8.9 8.8 8.3 7.5 7.2 7.4 8.8 9.3 9.3 8.7 8.2 8.3 8.5 8.6 8.5 8.2 8.1 7.9 8.6 8.7 8.7 8.5 8.4 8.5 8.7 8.7 8.6 8.5 8.3 8.0 8.2 8.1 8.1 8.0 7.9 7.9
 
Output produced by software:


Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time6 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135


Univariate ARIMA Extrapolation Forecast
timeY[t]F[t]95% LB95% UBp-value
(H0: Y[t] = F[t])
P(F[t]>Y[t-1])P(F[t]>Y[t-s])P(F[t]>Y[152])
1408.4-------
1418.4-------
1428.4-------
1438.4-------
1448.6-------
1458.9-------
1468.8-------
1478.3-------
1487.5-------
1497.2-------
1507.4-------
1518.8-------
1529.3-------
1539.39.35629.0439.66930.36260.637410.6374
1548.79.18718.61339.76090.04810.34990.99640.3499
1558.29.02398.22779.82010.02130.78740.93770.2483
1568.39.18688.255410.11820.0310.98110.89150.4058
1578.59.50718.493110.5210.02580.99020.87970.6555
1588.69.46198.381810.5420.05890.95960.88520.6156
1598.59.07467.919110.23010.16490.78960.90560.3511
1608.28.48227.24199.72260.32780.48880.93970.0981
1618.18.17556.85219.49890.45550.48550.92570.0479
1627.98.28346.88869.67820.2950.60170.89280.0766
1638.69.40877.951710.86560.13830.97880.79360.5581
1648.79.78538.269611.30090.08020.93730.73480.7348
1658.79.84168.204111.47910.08590.91410.74160.7416
1668.59.76587.972411.55910.08330.87790.87790.6946
1678.49.667.706211.61390.10310.87770.92850.641
1688.59.81437.729311.89930.10830.90820.92270.6856
1698.710.0817.890112.27190.10830.92140.92140.7576
1708.710.0087.72112.29490.13120.86880.88620.728
1718.69.63657.2512.02310.19730.77910.82470.6089
1728.59.08956.611.57910.32130.650.75810.4342
1738.38.79686.206611.38690.35350.58880.7010.3517
17488.89196.208711.57520.25740.66730.76560.3828
1758.29.98027.210212.75020.10390.91940.83560.6849
1768.110.34037.486613.1940.06190.92920.870.7625
1778.110.47.415413.38470.06550.93450.86790.765
178810.3397.198413.47960.07220.91880.87440.7416
1797.910.24076.93913.54240.08230.90830.86270.7117
1807.910.39226.949513.83490.0780.9220.85930.733


Univariate ARIMA Extrapolation Forecast Performance
time% S.E.PEMAPESq.EMSERMSE
1530.0171-0.00600.003200
1540.0319-0.0530.02950.23730.12020.3467
1550.045-0.09130.05010.67880.30640.5535
1560.0517-0.09650.06170.78640.42640.653
1570.0544-0.10590.07061.01420.5440.7375
1580.0582-0.09110.0740.74290.57710.7597
1590.065-0.06330.07250.33020.54180.7361
1600.0746-0.03330.06760.07960.48410.6957
1610.0826-0.00920.06110.00570.43090.6564
1620.0859-0.04630.05960.1470.40250.6344
1630.079-0.08590.0620.65390.42540.6522
1640.079-0.11090.06611.17780.48810.6986
1650.0849-0.1160.06991.30330.55080.7422
1660.0937-0.12960.07421.60210.62590.7911
1670.1032-0.13040.07791.58770.690.8307
1680.1084-0.13390.08141.72730.75480.8688
1690.1109-0.1370.08471.90710.82260.907
1700.1166-0.13070.08721.71080.8720.9338
1710.1264-0.10760.08831.07440.88260.9395
1720.1397-0.06490.08710.34750.85590.9251
1730.1502-0.05650.08570.24680.82690.9093
1740.154-0.10030.08630.79560.82540.9085
1750.1416-0.17840.09043.16920.92730.963
1760.1408-0.21670.09565.01891.09781.0478
1770.1464-0.22120.10065.29021.26551.125
1780.155-0.22620.10555.47091.42731.1947
1790.1645-0.22860.115.4791.57731.2559
1800.169-0.23980.11476.21091.74281.3202
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2009/Dec/11/t1260543090s4ncy1x3vkhi28s/1qvzu1260543018.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/11/t1260543090s4ncy1x3vkhi28s/1qvzu1260543018.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/11/t1260543090s4ncy1x3vkhi28s/2g0pt1260543019.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/11/t1260543090s4ncy1x3vkhi28s/2g0pt1260543019.ps (open in new window)


 
Parameters (Session):
par1 = 12 ; par2 = 1 ; par3 = 1 ; par4 = 1 ; par5 = 12 ; par6 = 3 ; par7 = 0 ; par8 = 1 ; par9 = 1 ; par10 = FALSE ;
 
Parameters (R input):
par1 = 12 ; par2 = 1 ; par3 = 1 ; par4 = 1 ; par5 = 12 ; par6 = 3 ; par7 = 0 ; par8 = 1 ; par9 = 1 ; par10 = FALSE ;
 
R code (references can be found in the software module):
par1 <- as.numeric(par1) #cut off periods
par1 <- 28
par2 <- as.numeric(par2) #lambda
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) #p
par6 <- 3
par7 <- as.numeric(par7) #q
par7 <- 3
par8 <- as.numeric(par8) #P
par9 <- as.numeric(par9) #Q
if (par10 == 'TRUE') par10 <- TRUE
if (par10 == 'FALSE') par10 <- FALSE
if (par2 == 0) x <- log(x)
if (par2 != 0) x <- x^par2
lx <- length(x)
first <- lx - 2*par1
nx <- lx - par1
nx1 <- nx + 1
fx <- lx - nx
if (fx < 1) {
fx <- par5
nx1 <- lx + fx - 1
first <- lx - 2*fx
}
first <- 1
if (fx < 3) fx <- round(lx/10,0)
(arima.out <- arima(x[1:nx], order=c(par6,par3,par7), seasonal=list(order=c(par8,par4,par9), period=par5), include.mean=par10, method='ML'))
(forecast <- predict(arima.out,par1))
(lb <- forecast$pred - 1.96 * forecast$se)
(ub <- forecast$pred + 1.96 * forecast$se)
if (par2 == 0) {
x <- exp(x)
forecast$pred <- exp(forecast$pred)
lb <- exp(lb)
ub <- exp(ub)
}
if (par2 != 0) {
x <- x^(1/par2)
forecast$pred <- forecast$pred^(1/par2)
lb <- lb^(1/par2)
ub <- ub^(1/par2)
}
if (par2 < 0) {
olb <- lb
lb <- ub
ub <- olb
}
(actandfor <- c(x[1:nx], forecast$pred))
(perc.se <- (ub-forecast$pred)/1.96/forecast$pred)
bitmap(file='test1.png')
opar <- par(mar=c(4,4,2,2),las=1)
ylim <- c( min(x[first:nx],lb), max(x[first:nx],ub))
plot(x,ylim=ylim,type='n',xlim=c(first,lx))
usr <- par('usr')
rect(usr[1],usr[3],nx+1,usr[4],border=NA,col='lemonchiffon')
rect(nx1,usr[3],usr[2],usr[4],border=NA,col='lavender')
abline(h= (-3:3)*2 , col ='gray', lty =3)
polygon( c(nx1:lx,lx:nx1), c(lb,rev(ub)), col = 'orange', lty=2,border=NA)
lines(nx1:lx, lb , lty=2)
lines(nx1:lx, ub , lty=2)
lines(x, lwd=2)
lines(nx1:lx, forecast$pred , lwd=2 , col ='white')
box()
par(opar)
dev.off()
prob.dec <- array(NA, dim=fx)
prob.sdec <- array(NA, dim=fx)
prob.ldec <- array(NA, dim=fx)
prob.pval <- array(NA, dim=fx)
perf.pe <- array(0, dim=fx)
perf.mape <- array(0, dim=fx)
perf.mape1 <- array(0, dim=fx)
perf.se <- array(0, dim=fx)
perf.mse <- array(0, dim=fx)
perf.mse1 <- array(0, dim=fx)
perf.rmse <- array(0, dim=fx)
for (i in 1:fx) {
locSD <- (ub[i] - forecast$pred[i]) / 1.96
perf.pe[i] = (x[nx+i] - forecast$pred[i]) / forecast$pred[i]
perf.se[i] = (x[nx+i] - forecast$pred[i])^2
prob.dec[i] = pnorm((x[nx+i-1] - forecast$pred[i]) / locSD)
prob.sdec[i] = pnorm((x[nx+i-par5] - forecast$pred[i]) / locSD)
prob.ldec[i] = pnorm((x[nx] - forecast$pred[i]) / locSD)
prob.pval[i] = pnorm(abs(x[nx+i] - forecast$pred[i]) / locSD)
}
perf.mape[1] = abs(perf.pe[1])
perf.mse[1] = abs(perf.se[1])
for (i in 2:fx) {
perf.mape[i] = perf.mape[i-1] + abs(perf.pe[i])
perf.mape1[i] = perf.mape[i] / i
perf.mse[i] = perf.mse[i-1] + perf.se[i]
perf.mse1[i] = perf.mse[i] / i
}
perf.rmse = sqrt(perf.mse1)
bitmap(file='test2.png')
plot(forecast$pred, pch=19, type='b',main='ARIMA Extrapolation Forecast', ylab='Forecast and 95% CI', xlab='time',ylim=c(min(lb),max(ub)))
dum <- forecast$pred
dum[1:par1] <- x[(nx+1):lx]
lines(dum, lty=1)
lines(ub,lty=3)
lines(lb,lty=3)
dev.off()
load(file='createtable')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Univariate ARIMA Extrapolation Forecast',9,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'time',1,header=TRUE)
a<-table.element(a,'Y[t]',1,header=TRUE)
a<-table.element(a,'F[t]',1,header=TRUE)
a<-table.element(a,'95% LB',1,header=TRUE)
a<-table.element(a,'95% UB',1,header=TRUE)
a<-table.element(a,'p-value<br />(H0: Y[t] = F[t])',1,header=TRUE)
a<-table.element(a,'P(F[t]>Y[t-1])',1,header=TRUE)
a<-table.element(a,'P(F[t]>Y[t-s])',1,header=TRUE)
mylab <- paste('P(F[t]>Y[',nx,sep='')
mylab <- paste(mylab,'])',sep='')
a<-table.element(a,mylab,1,header=TRUE)
a<-table.row.end(a)
for (i in (nx-par5):nx) {
a<-table.row.start(a)
a<-table.element(a,i,header=TRUE)
a<-table.element(a,x[i])
a<-table.element(a,'-')
a<-table.element(a,'-')
a<-table.element(a,'-')
a<-table.element(a,'-')
a<-table.element(a,'-')
a<-table.element(a,'-')
a<-table.element(a,'-')
a<-table.row.end(a)
}
for (i in 1:fx) {
a<-table.row.start(a)
a<-table.element(a,nx+i,header=TRUE)
a<-table.element(a,round(x[nx+i],4))
a<-table.element(a,round(forecast$pred[i],4))
a<-table.element(a,round(lb[i],4))
a<-table.element(a,round(ub[i],4))
a<-table.element(a,round((1-prob.pval[i]),4))
a<-table.element(a,round((1-prob.dec[i]),4))
a<-table.element(a,round((1-prob.sdec[i]),4))
a<-table.element(a,round((1-prob.ldec[i]),4))
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,'Univariate ARIMA Extrapolation Forecast Performance',7,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'time',1,header=TRUE)
a<-table.element(a,'% S.E.',1,header=TRUE)
a<-table.element(a,'PE',1,header=TRUE)
a<-table.element(a,'MAPE',1,header=TRUE)
a<-table.element(a,'Sq.E',1,header=TRUE)
a<-table.element(a,'MSE',1,header=TRUE)
a<-table.element(a,'RMSE',1,header=TRUE)
a<-table.row.end(a)
for (i in 1:fx) {
a<-table.row.start(a)
a<-table.element(a,nx+i,header=TRUE)
a<-table.element(a,round(perc.se[i],4))
a<-table.element(a,round(perf.pe[i],4))
a<-table.element(a,round(perf.mape1[i],4))
a<-table.element(a,round(perf.se[i],4))
a<-table.element(a,round(perf.mse1[i],4))
a<-table.element(a,round(perf.rmse[i],4))
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