Home » date » 2009 » Dec » 30 »

Paper ARIMA Forecasting 33

*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: Wed, 30 Dec 2009 07:04:28 -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/30/t1262181997a6uwhj4kqm04x0i.htm/, Retrieved Wed, 30 Dec 2009 15:06:39 +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/30/t1262181997a6uwhj4kqm04x0i.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 time3 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[183])
171247.94-------
172248.8-------
173250.18-------
174251.55-------
175254.4-------
176255.72-------
177257.69-------
178258.37-------
179258.22-------
180258.59-------
181257.45-------
182257.45-------
183256.73-------
184258.82257.589251.9262263.51230.34190.61190.99820.6119
185257.99258.4618250.8861266.50920.45430.46520.97820.6634
186262.85259.6428250.0186270.03760.27270.62230.93650.7086
187262.58261.1406249.2966274.16610.41430.39850.84480.7466
188261.55263.0623249.157278.61150.42440.52420.82260.7876
189261.25264.4204248.4822282.54320.36580.62190.76670.7972
190259.78265.6029247.6625286.34540.29110.65960.75280.7991
191256.26266.1472246.3129289.45570.20290.70380.74750.7858
192254.29267.4502245.6076293.5570.16160.79960.7470.7895
193248.5267.3428243.718296.03940.09910.81370.75040.7657
194241.88268.167242.6084299.74490.05140.88890.7470.7611
195238.53269.0059241.5004303.58230.0420.93790.75670.7567
196232.24269.5212239.7159307.79080.02810.94380.70820.7438
197232.46270.398238.3032312.48320.03860.96220.71830.7378
198225.79271.4541236.9882317.6510.02630.9510.64250.7339
199221.63272.61235.7039323.21890.02420.96510.65120.7307
200219.62274.1984234.7364329.60970.02680.96850.67270.7317
201215.94275.2603233.3557335.50880.02680.96490.67570.7267
202211.81276.1564231.8445341.40920.02660.96480.68860.7202
203205.57276.5105229.952346.7090.02380.96460.71410.7096
204201.25277.507228.5003353.27390.02430.96860.72590.7045
205194.7277.2944226.2341358.12130.02260.96740.75750.691
206187.94277.8788224.5089364.53560.0210.970.79220.6838
207185.61278.473222.7905371.26370.02490.97210.80060.677
208181.15278.7901220.6785378.44690.02740.96660.820.6678
209186.5279.4132218.8078386.45310.04440.9640.8050.6611
210183.21280.1863217.0118395.24710.04930.94470.82290.6553
211182.61281.041215.246404.76790.05950.93940.82670.6499
212187.09282.2573213.6942415.60180.08090.92850.82140.6463
213189.1283.0258211.8782426.1120.09910.90560.82090.6407
214191.25283.6526209.9872436.93270.11870.88670.82090.6347
215190.74283.8232207.8598447.28640.13220.86650.8260.6274
216190.79284.5306206.0321459.66270.14710.85310.82430.6221


Univariate ARIMA Extrapolation Forecast Performance
time% S.E.PEMAPESq.EMSERMSE
1840.01170.004801.515400
1850.0159-0.00180.00330.22260.8690.9322
1860.02040.01240.006310.2864.0082.002
1870.02540.00550.00612.07193.5241.8772
1880.0302-0.00570.0062.2873.27661.8101
1890.035-0.0120.00710.05134.40572.099
1900.0398-0.02190.009233.90588.622.936
1910.0447-0.03710.012797.757219.76214.4455
1920.0498-0.04920.0167173.190836.80986.0671
1930.0548-0.07050.0221355.051568.63398.2846
1940.0601-0.0980.029691.006125.213211.1899
1950.0656-0.11330.036928.7828192.177313.8628
1960.0724-0.13830.04391389.8897284.309116.8615
1970.0794-0.14030.05081439.2881366.807619.1522
1980.0868-0.16820.05862085.2094481.367721.9401
1990.0947-0.1870.06662598.9581613.717124.7733
2000.1031-0.1990.07442978.805752.839927.4379
2010.1117-0.21550.08233518.8925906.509530.1083
2020.1206-0.2330.09024140.46431076.717732.8134
2030.1295-0.25660.09855032.55931274.509735.7003
2040.1393-0.27480.10695815.1291490.729738.61
2050.1487-0.29790.11566821.84121733.052941.63
2060.1591-0.32370.12468088.98652009.397944.8263
2070.17-0.33350.13338623.52992284.986747.8015
2080.1824-0.35020.1429533.58492574.930650.7438
2090.1955-0.33250.14938632.87142807.928452.9899
2100.2095-0.34610.15669404.40573052.242355.2471
2110.2246-0.35020.16359688.66883289.257657.352
2120.241-0.33720.16959056.81613488.138959.0605
2130.2579-0.33190.17498822.0613665.936360.547
2140.2757-0.32580.17988538.24943823.107761.8313
2150.2938-0.3280.18448664.49023974.400963.0428
2160.314-0.32950.18888787.30294120.246464.1891
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2009/Dec/30/t1262181997a6uwhj4kqm04x0i/1bwiy1262181865.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/30/t1262181997a6uwhj4kqm04x0i/1bwiy1262181865.ps (open in new window)


http://www.freestatistics.org/blog/date/2009/Dec/30/t1262181997a6uwhj4kqm04x0i/21ep91262181865.png (open in new window)
http://www.freestatistics.org/blog/date/2009/Dec/30/t1262181997a6uwhj4kqm04x0i/21ep91262181865.ps (open in new window)


 
Parameters (Session):
par1 = 0 ; par2 = -1.0 ; par3 = 2 ; par4 = 0 ; par5 = 12 ; par6 = 3 ; par7 = 1 ; par8 = 1 ; par9 = 1 ; par10 = FALSE ;
 
Parameters (R input):
par1 = 0 ; 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 <- 33
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