Home » date » 2010 » May » 13 »

B521,steven,coomans,thesis,Arima

*Unverified author*
R Software Module: Patrick.Wessa/rwasp_demand_forecasting_croston.wasp (opens new window with default values)
Title produced by software: Croston Forecasting
Date of computation: Thu, 13 May 2010 12:07:59 +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/May/13/t1273752512ppxnc3e54l2tk1r.htm/, Retrieved Thu, 13 May 2010 14:08:35 +0200
 
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/May/13/t1273752512ppxnc3e54l2tk1r.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:
B521,steven,coomans,thesis,Arima
 
Dataseries X:
» Textbox « » Textfile « » CSV «
387 295.5 343.35 264.025 322.5 392.5 315.75 274.4 361.875 411.276 518.775 392.55 467 382.852 449.25 564.252 417 450.8 538.675 394 532 461.4 523 405.9 386.25 384.5 382 381.75 151.5 287.775 247.6 290.35 266.55 318.025 213.3 148.75 273 282.25 191.25 142.25 259.25 272.75 173.75 204.75 185.525 267.175 190.25 127.25 183.5 254.125
 
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 Serverwessa.org @ wessa.org


Demand Forecast
PointForecast95% LB80% LB80% UB95% UB
51210.10238843579667.9893263254586117.179651758785303.025125112807352.215450546133
52210.10238843579656.79208678965109.858170359085310.346606512507363.412690081942
53210.10238843579646.358763340686103.036186840346317.168590031246373.846013530906
54210.10238843579636.551528663383496.6235807651842323.581196106408383.653248208209
55210.10238843579627.269603913437290.5544563892318329.65032048236392.935172958155
56210.10238843579618.43665528389784.7789017189154335.425875152677401.768121587695
57210.1023884357969.9932196475802579.2580359052325340.946740966360410.211557224012
58210.1023884357961.8919045461362073.9608706853001346.243906186292418.312872325456
59210.102388435796-5.9057868030638568.8622343659465351.342542505646426.110563674656
60210.102388435796-13.431631208815763.9413492087125356.26342766288433.636408080408
61210.102388435796-20.712221385448559.180827172313361.023949699279440.916998257041
62210.102388435796-27.770077972968954.565942801747365.638834069845447.974854844561
63210.102388435796-34.624472459866050.0840951479981370.120681723594454.829249331458
64210.102388435796-41.292047883507545.7244019138596374.480374957733461.4968247551
65210.102388435796-47.787294918843141.4773881562641378.727388715328467.992071790435
66210.102388435796-54.122922519100437.3347439373588382.870032934233474.327699390692
67210.102388435796-60.310150322426933.2891331300792386.915643741513480.514927194019
68210.102388435796-66.358942108139329.3340407693121390.87073610228486.563718979731
69210.102388435796-72.278194208582625.4636498560033394.741127015589492.482971080175
70210.102388435796-78.075889064494421.6727409527015398.532035918891498.280665936087
71210.102388435796-83.759221495630817.9566096196340402.248167251958503.963998367223
72210.102388435796-89.33470338808914.3109979633452405.893778908247509.539480259681
73210.102388435796-94.808251143083510.7320374570160409.472739414576515.013028014676
74210.102388435796-100.1852592346477.21620084366808412.988576027924520.390036106239


Actuals and Interpolation
TimeActualForecast
1387386.613000262070
2295.5374.123316633082
3343.35336.048165995784
4264.025338.086548077006
5322.5307.542001780858
6392.5313.784027977660
7315.75345.706762345858
8274.4333.558139957923
9361.875309.612466337202
10411.276330.768423422594
11518.775363.353572983656
12392.55426.254986865821
13467412.614239712998
14382.852434.624717051376
15449.25413.671773960281
16564.252428.070647900106
17417483.184602478810
18450.8456.399032969728
19538.675454.133048676047
20394488.348019556919
21532450.164435084369
22461.4483.284104365518
23523474.427389078871
24405.9494.085209133688
25386.25458.395775524229
26384.5429.19766065875
27382411.108071619878
28381.75399.327744740213
29151.5392.213856140806
30287.775294.794557918947
31247.6291.953672823028
32290.35274.003299091931
33266.55280.618971975236
34318.025274.925118706862
35213.3292.368070501736
36148.75260.368433823036
37273215.195340483111
38282.25238.589462676036
39191.25256.259317558014
40142.25229.94939840372
41259.25194.456577242768
42272.75220.679121618065
43173.75241.752725402618
44204.75214.231344240327
45185.525210.394149668727
46267.175200.329356777518
47190.25227.382455241916
48127.25212.35458028317
49183.5177.911907893752
50254.125180.173464499248


What is next?
Simulate Time Series
Generate Forecasts
Forecast Analysis
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2010/May/13/t1273752512ppxnc3e54l2tk1r/1zv4p1273752476.png (open in new window)
http://www.freestatistics.org/blog/date/2010/May/13/t1273752512ppxnc3e54l2tk1r/1zv4p1273752476.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/May/13/t1273752512ppxnc3e54l2tk1r/2smms1273752476.png (open in new window)
http://www.freestatistics.org/blog/date/2010/May/13/t1273752512ppxnc3e54l2tk1r/2smms1273752476.ps (open in new window)


 
Parameters (Session):
par1 = Input box ; par2 = ARIMA ; par3 = NA ; par4 = NA ; par5 = ZZZ ; par6 = 12 ; par7 = dum ; par8 = dumresult ; par9 = 3 ; par10 = 0.1 ;
 
Parameters (R input):
par1 = Input box ; par2 = ARIMA ; par3 = NA ; par4 = NA ; par5 = ZZZ ; par6 = 12 ; par7 = dum ; par8 = dumresult ; par9 = 3 ; par10 = 0.1 ;
 
R code (references can be found in the software module):
par10 <- '0.1'
par9 <- '3'
par8 <- 'dumresult'
par7 <- 'dum'
par6 <- '12'
par5 <- 'ZZZ'
par4 <- 'NA'
par3 <- 'NA'
par2 <- 'ETS'
par1 <- 'Input box'
if(par3!='NA') par3 <- as.numeric(par3) else par3 <- NA
if(par4!='NA') par4 <- as.numeric(par4) else par4 <- NA
par6 <- as.numeric(par6) #Seasonal Period
par9 <- as.numeric(par9) #Forecast Horizon
par10 <- as.numeric(par10) #Alpha
library(forecast)
if (par1 == 'CSV') {
xarr <- read.csv(file=paste('tmp/',par7,'.csv',sep=''),header=T)
numseries <- length(xarr[1,])-1
n <- length(xarr[,1])
nmh <- n - par9
nmhp1 <- nmh + 1
rarr <- array(NA,dim=c(n,numseries))
farr <- array(NA,dim=c(n,numseries))
parr <- array(NA,dim=c(numseries,8))
colnames(parr) = list('ME','RMSE','MAE','MPE','MAPE','MASE','ACF1','TheilU')
for(i in 1:numseries) {
sindex <- i+1
x <- xarr[,sindex]
if(par2=='Croston') {
if (i==1) m <- croston(x,alpha=par10)
if (i==1) mydemand <- m$model$demand[]
fit <- croston(x[1:nmh],h=par9,alpha=par10)
}
if(par2=='ARIMA') {
m <- auto.arima(ts(x,freq=par6),d=par3,D=par4)
mydemand <- forecast(m)
fit <- auto.arima(ts(x[1:nmh],freq=par6),d=par3,D=par4)
}
if(par2=='ETS') {
m <- ets(ts(x,freq=par6),model=par5)
mydemand <- forecast(m)
fit <- ets(ts(x[1:nmh],freq=par6),model=par5)
}
try(rarr[,i] <- mydemand$resid,silent=T)
try(farr[,i] <- mydemand$mean,silent=T)
if (par2!='Croston') parr[i,] <- accuracy(forecast(fit,par9),x[nmhp1:n])
if (par2=='Croston') parr[i,] <- accuracy(fit,x[nmhp1:n])
}
write.csv(farr,file=paste('tmp/',par8,'_f.csv',sep=''))
write.csv(rarr,file=paste('tmp/',par8,'_r.csv',sep=''))
write.csv(parr,file=paste('tmp/',par8,'_p.csv',sep=''))
}
if (par1 == 'Input box') {
numseries <- 1
n <- length(x)
if(par2=='Croston') {
m <- croston(x)
mydemand <- m$model$demand[]
}
if(par2=='ARIMA') {
m <- auto.arima(ts(x,freq=par6),d=par3,D=par4)
mydemand <- forecast(m)
}
if(par2=='ETS') {
m <- ets(ts(x,freq=par6),model=par5)
mydemand <- forecast(m)
}
summary(m)
}
bitmap(file='test1.png')
op <- par(mfrow=c(2,1))
if (par2=='Croston') plot(m)
if ((par2=='ARIMA') | par2=='ETS') plot(forecast(m))
plot(mydemand$resid,type='l',main='Residuals', ylab='residual value', xlab='time')
par(op)
dev.off()
bitmap(file='pic2.png')
op <- par(mfrow=c(2,2))
acf(mydemand$resid, lag.max=n/3, main='Residual ACF', ylab='autocorrelation', xlab='time lag')
pacf(mydemand$resid,lag.max=n/3, main='Residual PACF', ylab='partial autocorrelation', xlab='time lag')
cpgram(mydemand$resid, main='Cumulative Periodogram of Residuals')
qqnorm(mydemand$resid); qqline(mydemand$resid, col=2)
par(op)
dev.off()
load(file='createtable')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Demand Forecast',6,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Point',header=TRUE)
a<-table.element(a,'Forecast',header=TRUE)
a<-table.element(a,'95% LB',header=TRUE)
a<-table.element(a,'80% LB',header=TRUE)
a<-table.element(a,'80% UB',header=TRUE)
a<-table.element(a,'95% UB',header=TRUE)
a<-table.row.end(a)
for (i in 1:length(mydemand$mean)) {
a<-table.row.start(a)
a<-table.element(a,i+n,header=TRUE)
a<-table.element(a,as.numeric(mydemand$mean[i]))
a<-table.element(a,as.numeric(mydemand$lower[i,2]))
a<-table.element(a,as.numeric(mydemand$lower[i,1]))
a<-table.element(a,as.numeric(mydemand$upper[i,1]))
a<-table.element(a,as.numeric(mydemand$upper[i,2]))
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,'Actuals and Interpolation',3,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Time',header=TRUE)
a<-table.element(a,'Actual',header=TRUE)
a<-table.element(a,'Forecast',header=TRUE)
a<-table.row.end(a)
for (i in 1:n) {
a<-table.row.start(a)
a<-table.element(a,i,header=TRUE)
a<-table.element(a,x[i])
a<-table.element(a,x[i] - as.numeric(m$resid[i]))
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable1.tab')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'What is next?',1,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,hyperlink(paste('http://www.wessa.net/Patrick.Wessa/rwasp_demand_forecasting_simulate.wasp',sep=''),'Simulate Time Series','',target=''))
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,hyperlink(paste('http://www.wessa.net/Patrick.Wessa/rwasp_demand_forecasting_croston.wasp',sep=''),'Generate Forecasts','',target=''))
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,hyperlink(paste('http://www.wessa.net/Patrick.Wessa/rwasp_demand_forecasting_analysis.wasp',sep=''),'Forecast Analysis','',target=''))
a<-table.row.end(a)
a<-table.end(a)
table.save(a,file='mytable0.tab')
-SERVER-wessa.org
 





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