Free Statistics

of Irreproducible Research!

Author's title

Author*Unverified author*
R Software ModulePatrick.Wessarwasp_demand_forecasting_croston.wasp
Title produced by softwareCroston Forecasting
Date of computationThu, 13 May 2010 14:10:16 +0000
Cite this page as followsStatistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?v=date/2010/May/13/t12737598491ci0kbdbs0m618h.htm/, Retrieved Mon, 06 May 2024 06:15:14 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=75954, Retrieved Mon, 06 May 2024 06:15:14 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywordsB580,steven,coomans,thesis,croston,per3maand
Estimated Impact105
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-       [Croston Forecasting] [B580,steven,cooma...] [2010-05-13 14:10:16] [d41d8cd98f00b204e9800998ecf8427e] [Current]
Feedback Forum

Post a new message
Dataseries X:
210,5
186,8666667
204,6083333
275,6333333
326,2173333
213,5416667
199,7
298,4166667
270,4333333
141
185,4833333
153,2266667
141,4583333
127,4583333
180,3583333
191,25
162,1833333




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time1 seconds
R Serverwessa.org @ wessa.org

\begin{tabular}{lllllllll}
\hline
Summary of computational transaction \tabularnewline
Raw Input & view raw input (R code)  \tabularnewline
Raw Output & view raw output of R engine  \tabularnewline
Computing time & 1 seconds \tabularnewline
R Server & wessa.org @ wessa.org \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=75954&T=0

[TABLE]
[ROW][C]Summary of computational transaction[/C][/ROW]
[ROW][C]Raw Input[/C][C]view raw input (R code) [/C][/ROW]
[ROW][C]Raw Output[/C][C]view raw output of R engine [/C][/ROW]
[ROW][C]Computing time[/C][C]1 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]wessa.org @ wessa.org[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=75954&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75954&T=0

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time1 seconds
R Serverwessa.org @ wessa.org







Demand Forecast
PointForecast95% LB80% LB80% UB95% UB
18192.88252502071477.8699610577834117.679851621294268.085198420135307.895088983645
19192.88252502071477.2963287513477117.304773616719268.460276424710308.468721290081
20192.88252502071476.7255292489838116.931547883167268.833502158262309.039520792445
21192.88252502071476.1575209924125116.560147247138269.204902794291309.607529049016
22192.88252502071475.5922634296497116.190545193116269.574504848312310.172786611779
23192.88252502071475.0297169812211115.822715841474269.942334199955310.735333060208
24192.88252502071474.4698430078197115.456633927327270.308416114102311.295207033609
25192.88252502071473.9126037793343115.092274780281270.672775261148311.852446262094
26192.88252502071473.3579624451774114.729614305031271.035435736397312.407087596251
27192.88252502071472.8058830058465114.36862896277271.396421078659312.959167035582

\begin{tabular}{lllllllll}
\hline
Demand Forecast \tabularnewline
Point & Forecast & 95% LB & 80% LB & 80% UB & 95% UB \tabularnewline
18 & 192.882525020714 & 77.8699610577834 & 117.679851621294 & 268.085198420135 & 307.895088983645 \tabularnewline
19 & 192.882525020714 & 77.2963287513477 & 117.304773616719 & 268.460276424710 & 308.468721290081 \tabularnewline
20 & 192.882525020714 & 76.7255292489838 & 116.931547883167 & 268.833502158262 & 309.039520792445 \tabularnewline
21 & 192.882525020714 & 76.1575209924125 & 116.560147247138 & 269.204902794291 & 309.607529049016 \tabularnewline
22 & 192.882525020714 & 75.5922634296497 & 116.190545193116 & 269.574504848312 & 310.172786611779 \tabularnewline
23 & 192.882525020714 & 75.0297169812211 & 115.822715841474 & 269.942334199955 & 310.735333060208 \tabularnewline
24 & 192.882525020714 & 74.4698430078197 & 115.456633927327 & 270.308416114102 & 311.295207033609 \tabularnewline
25 & 192.882525020714 & 73.9126037793343 & 115.092274780281 & 270.672775261148 & 311.852446262094 \tabularnewline
26 & 192.882525020714 & 73.3579624451774 & 114.729614305031 & 271.035435736397 & 312.407087596251 \tabularnewline
27 & 192.882525020714 & 72.8058830058465 & 114.36862896277 & 271.396421078659 & 312.959167035582 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=75954&T=1

[TABLE]
[ROW][C]Demand Forecast[/C][/ROW]
[ROW][C]Point[/C][C]Forecast[/C][C]95% LB[/C][C]80% LB[/C][C]80% UB[/C][C]95% UB[/C][/ROW]
[ROW][C]18[/C][C]192.882525020714[/C][C]77.8699610577834[/C][C]117.679851621294[/C][C]268.085198420135[/C][C]307.895088983645[/C][/ROW]
[ROW][C]19[/C][C]192.882525020714[/C][C]77.2963287513477[/C][C]117.304773616719[/C][C]268.460276424710[/C][C]308.468721290081[/C][/ROW]
[ROW][C]20[/C][C]192.882525020714[/C][C]76.7255292489838[/C][C]116.931547883167[/C][C]268.833502158262[/C][C]309.039520792445[/C][/ROW]
[ROW][C]21[/C][C]192.882525020714[/C][C]76.1575209924125[/C][C]116.560147247138[/C][C]269.204902794291[/C][C]309.607529049016[/C][/ROW]
[ROW][C]22[/C][C]192.882525020714[/C][C]75.5922634296497[/C][C]116.190545193116[/C][C]269.574504848312[/C][C]310.172786611779[/C][/ROW]
[ROW][C]23[/C][C]192.882525020714[/C][C]75.0297169812211[/C][C]115.822715841474[/C][C]269.942334199955[/C][C]310.735333060208[/C][/ROW]
[ROW][C]24[/C][C]192.882525020714[/C][C]74.4698430078197[/C][C]115.456633927327[/C][C]270.308416114102[/C][C]311.295207033609[/C][/ROW]
[ROW][C]25[/C][C]192.882525020714[/C][C]73.9126037793343[/C][C]115.092274780281[/C][C]270.672775261148[/C][C]311.852446262094[/C][/ROW]
[ROW][C]26[/C][C]192.882525020714[/C][C]73.3579624451774[/C][C]114.729614305031[/C][C]271.035435736397[/C][C]312.407087596251[/C][/ROW]
[ROW][C]27[/C][C]192.882525020714[/C][C]72.8058830058465[/C][C]114.36862896277[/C][C]271.396421078659[/C][C]312.959167035582[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=75954&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75954&T=1

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Demand Forecast
PointForecast95% LB80% LB80% UB95% UB
18192.88252502071477.8699610577834117.679851621294268.085198420135307.895088983645
19192.88252502071477.2963287513477117.304773616719268.460276424710308.468721290081
20192.88252502071476.7255292489838116.931547883167268.833502158262309.039520792445
21192.88252502071476.1575209924125116.560147247138269.204902794291309.607529049016
22192.88252502071475.5922634296497116.190545193116269.574504848312310.172786611779
23192.88252502071475.0297169812211115.822715841474269.942334199955310.735333060208
24192.88252502071474.4698430078197115.456633927327270.308416114102311.295207033609
25192.88252502071473.9126037793343115.092274780281270.672775261148311.852446262094
26192.88252502071473.3579624451774114.729614305031271.035435736397312.407087596251
27192.88252502071472.8058830058465114.36862896277271.396421078659312.959167035582







Actuals and Interpolation
TimeActualForecast
1210.5NA
2186.8666667210.5
3204.6083333208.13666667
4275.6333333207.783833333
5326.2173333214.5687833297
6213.5416667225.73363832673
7199.7224.514441164057
8298.4166667222.032997047651
9270.4333333229.671364012886
10141233.747560941598
11185.4833333224.472804847438
12153.2266667220.573857692694
13141.4583333213.839138593425
14127.4583333206.601058064082
15180.3583333198.686785587674
16191.25196.853940358907
17162.1833333196.293546323016

\begin{tabular}{lllllllll}
\hline
Actuals and Interpolation \tabularnewline
Time & Actual & Forecast \tabularnewline
1 & 210.5 & NA \tabularnewline
2 & 186.8666667 & 210.5 \tabularnewline
3 & 204.6083333 & 208.13666667 \tabularnewline
4 & 275.6333333 & 207.783833333 \tabularnewline
5 & 326.2173333 & 214.5687833297 \tabularnewline
6 & 213.5416667 & 225.73363832673 \tabularnewline
7 & 199.7 & 224.514441164057 \tabularnewline
8 & 298.4166667 & 222.032997047651 \tabularnewline
9 & 270.4333333 & 229.671364012886 \tabularnewline
10 & 141 & 233.747560941598 \tabularnewline
11 & 185.4833333 & 224.472804847438 \tabularnewline
12 & 153.2266667 & 220.573857692694 \tabularnewline
13 & 141.4583333 & 213.839138593425 \tabularnewline
14 & 127.4583333 & 206.601058064082 \tabularnewline
15 & 180.3583333 & 198.686785587674 \tabularnewline
16 & 191.25 & 196.853940358907 \tabularnewline
17 & 162.1833333 & 196.293546323016 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=75954&T=2

[TABLE]
[ROW][C]Actuals and Interpolation[/C][/ROW]
[ROW][C]Time[/C][C]Actual[/C][C]Forecast[/C][/ROW]
[ROW][C]1[/C][C]210.5[/C][C]NA[/C][/ROW]
[ROW][C]2[/C][C]186.8666667[/C][C]210.5[/C][/ROW]
[ROW][C]3[/C][C]204.6083333[/C][C]208.13666667[/C][/ROW]
[ROW][C]4[/C][C]275.6333333[/C][C]207.783833333[/C][/ROW]
[ROW][C]5[/C][C]326.2173333[/C][C]214.5687833297[/C][/ROW]
[ROW][C]6[/C][C]213.5416667[/C][C]225.73363832673[/C][/ROW]
[ROW][C]7[/C][C]199.7[/C][C]224.514441164057[/C][/ROW]
[ROW][C]8[/C][C]298.4166667[/C][C]222.032997047651[/C][/ROW]
[ROW][C]9[/C][C]270.4333333[/C][C]229.671364012886[/C][/ROW]
[ROW][C]10[/C][C]141[/C][C]233.747560941598[/C][/ROW]
[ROW][C]11[/C][C]185.4833333[/C][C]224.472804847438[/C][/ROW]
[ROW][C]12[/C][C]153.2266667[/C][C]220.573857692694[/C][/ROW]
[ROW][C]13[/C][C]141.4583333[/C][C]213.839138593425[/C][/ROW]
[ROW][C]14[/C][C]127.4583333[/C][C]206.601058064082[/C][/ROW]
[ROW][C]15[/C][C]180.3583333[/C][C]198.686785587674[/C][/ROW]
[ROW][C]16[/C][C]191.25[/C][C]196.853940358907[/C][/ROW]
[ROW][C]17[/C][C]162.1833333[/C][C]196.293546323016[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=75954&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75954&T=2

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Actuals and Interpolation
TimeActualForecast
1210.5NA
2186.8666667210.5
3204.6083333208.13666667
4275.6333333207.783833333
5326.2173333214.5687833297
6213.5416667225.73363832673
7199.7224.514441164057
8298.4166667222.032997047651
9270.4333333229.671364012886
10141233.747560941598
11185.4833333224.472804847438
12153.2266667220.573857692694
13141.4583333213.839138593425
14127.4583333206.601058064082
15180.3583333198.686785587674
16191.25196.853940358907
17162.1833333196.293546323016







\begin{tabular}{lllllllll}
\hline
What is next? \tabularnewline
Simulate Time Series \tabularnewline
Generate Forecasts \tabularnewline
Forecast Analysis \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=75954&T=3

[TABLE]
[ROW][C]What is next?[/C][/ROW]
[ROW][C]Simulate Time Series[/C][/ROW]
[ROW][C]Generate Forecasts[/C][/ROW]
[ROW][C]Forecast Analysis[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=75954&T=3

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75954&T=3

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

What is next?
Simulate Time Series
Generate Forecasts
Forecast Analysis



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 = Croston ; 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):
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('https://automated.biganalytics.eu/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('https://automated.biganalytics.eu/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('https://automated.biganalytics.eu/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