Home » date » 2009 » Dec » 27 »

Paper ARIMA Forecasting

*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: Sun, 27 Dec 2009 06:08:29 -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/27/t1261919454pm1g9k6fmx6ykdr.htm/, Retrieved Sun, 27 Dec 2009 14:10:57 +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/27/t1261919454pm1g9k6fmx6ykdr.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 «
100.21 100.36 100.62 100.78 100.93 100.70 100.00 100.20 99.68 99.56 100.06 100.50 99.30 99.37 99.20 98.11 97.60 97.76 98.06 98.25 98.50 97.39 98.09 97.78 98.12 97.50 97.30 97.64 96.88 97.40 98.27 97.94 98.61 98.72 98.62 98.56 98.06 97.40 97.76 97.05 97.85 97.40 97.27 97.93 98.60 98.70 98.88 98.27 97.85 97.70 96.97 97.72 97.66 99.00 98.86 99.56 100.19 100.37 100.01 99.68 99.78 99.36 99.21 99.26 99.26 100.43 101.50 102.27 102.69 103.47 104.02 103.55 103.77 104.19 103.64 103.68 105.39 106.61 108.12 109.22 110.17 110.31 111.06 111.14 111.39 112.51 111.28 112.22 113.19 114.32 115.34 116.61 117.83 117.70 118.51 118.82 119.49 119.57 120.00 121.96 121.45 123.41 124.44 126.25 127.41 127.63 129.19 129.82 130.45 132.02 132.72 132.96 135.06 137.04 137.83 139.17 140.35 141.01 141.89 143.28 142.90 143.37 145.03 146.05 147.39 149.58 151.02 153.57 155.60 157.18 158.77 159.95 161.34 161.95 163. etc...
 
Output produced by software:


Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time2 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[190])
178258.37-------
179258.22-------
180258.59-------
181257.45-------
182257.45-------
183256.73-------
184258.82-------
185257.99-------
186262.85-------
187262.58-------
188261.55-------
189261.25-------
190259.78-------
191256.26259.784254.0673265.7640.1240.50050.69590.5005
192254.29260.1901252.5713268.28290.07650.82940.65080.5396
193248.5259.3232249.7811269.62340.01970.83090.63920.4654
194241.88259.5327247.9076272.30180.00340.95480.62540.4849
195238.53259.6815246.1932274.73330.00290.98980.64960.4949
196232.24259.8257244.4804277.22649e-040.99180.54510.5021
197232.46259.6751242.5432279.41110.00340.99680.56650.4958
198225.79260.8315241.7694283.15670.0010.99360.42970.5368
199221.63260.9154240.0704285.72450.0010.99720.44770.5357
200219.62261.1297238.4918288.51590.00150.99770.4880.5385
201215.94261.1363236.7462291.12910.00160.99670.4970.5353
202211.81260.7761234.7087293.35720.00160.99650.52390.5239
203205.57260.3818232.2713296.23330.00140.9960.58910.5131
204201.25260.4862230.3322299.72480.00150.9970.62150.5141
205194.7259.542227.5666301.97220.00140.99650.6950.4956
206187.94259.3382225.3716305.36030.00120.9970.77140.4925
207185.61259.1267223.2009308.83610.00190.99750.79160.4897
208181.15258.8937221.0257312.42030.00220.99640.83550.4871
209186.5258.4222218.6963315.7840.0070.99590.81250.4815
210183.21258.9807217.1152320.84860.00820.98920.85350.4899
211182.61258.6943214.9468324.79990.0120.98740.86410.4872
212187.09258.51212.8657329.07220.02360.98250.860.4859
213189.1258.165210.6931333.25070.03570.96820.86480.4832
214191.25257.5367208.3545337.11220.05130.95410.870.478
215190.74256.8844205.8339341.60960.0630.93550.88240.4733
216190.79256.6187203.6251346.89960.07650.92370.88530.4726


Univariate ARIMA Extrapolation Forecast Performance
time% S.E.PEMAPESq.EMSERMSE
1910.0117-0.0136012.418900
1920.0159-0.02270.018134.811723.61534.8596
1930.0203-0.04170.026117.142154.79097.4021
1940.0251-0.0680.0365311.6195118.99810.9086
1950.0296-0.08150.0455447.384184.675213.5895
1960.0342-0.10620.0556760.9716280.724616.7548
1970.0388-0.10480.0626740.6613346.429918.6126
1980.0437-0.13430.07161227.904456.614121.3685
1990.0485-0.15060.08041543.3417577.361624.0284
2000.0535-0.1590.08821723.0537691.930926.3046
2010.0586-0.17310.09592042.7076814.728728.5435
2020.0637-0.18780.10362397.6816946.641530.7675
2030.0702-0.21050.11183004.3331104.925433.2404
2040.0769-0.22740.12013508.93111276.640135.7301
2050.0834-0.24980.12874204.48451471.829838.3644
2060.0905-0.27530.13795097.70521698.44741.2122
2070.0979-0.28370.14655404.69891916.461843.7774
2080.1055-0.30030.1556044.08442145.774246.3225
2090.1132-0.27830.16155172.80022305.091348.0114
2100.1219-0.29260.16815741.19362476.896449.7684
2110.1304-0.29410.17415788.8162634.606951.3284
2120.1393-0.27630.17875100.81322746.707252.409
2130.1484-0.26750.18264769.97252834.675253.2417
2140.1576-0.25740.18574393.92112899.643853.8483
2150.1683-0.25750.18864375.07692958.661154.3936
2160.1795-0.25650.19124333.42173011.536554.8775
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2009/Dec/27/t1261919454pm1g9k6fmx6ykdr/1430u1261919306.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/27/t1261919454pm1g9k6fmx6ykdr/1430u1261919306.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/27/t1261919454pm1g9k6fmx6ykdr/251oe1261919306.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/27/t1261919454pm1g9k6fmx6ykdr/251oe1261919306.ps (open in new window)


 
Parameters (Session):
par1 = Default ; par2 = -1.0 ; par3 = 1 ; par4 = 0 ; par5 = 12 ; par6 = White Noise ; par7 = 0.95 ;
 
Parameters (R input):
par1 = 24 ; par2 = -1.0 ; par3 = 2 ; par4 = 0 ; par5 = 12 ; par6 = 3 ; par7 = 1 ; par8 = 1 ; par9 = 1 ; par10 = FALSE ;
 
R code (references can be found in the software module):
par1 <- 26
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
par7 <- as.numeric(par7) #q
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