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:13:34 +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/t1273760053lcrzpx86ocebycr.htm/, Retrieved Mon, 06 May 2024 02:41:30 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=75957, Retrieved Mon, 06 May 2024 02:41:30 +0000
QR Codes:

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

Post a new message
Dataseries X:
721,8416667
644,5833333
554,4333333
562,9666667
711,675
531,1083333
379,95
336,25
370,175
493,0833333
657,7666667
533,4583333
402,2833333
267,3416667
447,5416667
297,7583333
268,4166667




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

\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 & 2 seconds \tabularnewline
R Server & wessa.org @ wessa.org \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=75957&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]2 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]wessa.org @ wessa.org[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=75957&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75957&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 time2 seconds
R Serverwessa.org @ wessa.org







Demand Forecast
PointForecast95% LB80% LB80% UB95% UB
18478.814478803637255.810455878236332.999985804237624.628971803038701.81850172904
19478.814478803637254.698209462649332.272726963560625.356230643715702.930748144626
20478.814478803637253.591455722667331.549059590417626.079898016858704.037501884608
21478.814478803637252.490114078713330.828930996656626.800026610619705.138843528562
22478.814478803637251.394105902374330.112289769921627.516667837354706.234851704901
23478.814478803637250.303354450885329.399085730816628.22987187646707.32560315639
24478.814478803637249.217784804425328.689269891901628.939687715374708.41117280285
25478.814478803637248.137323806058327.982794418428629.646163188847709.491633801217
26478.814478803637247.061900004207327.279612590723630.349345016552710.567057603068
27478.814478803637245.991443597506326.579678768124631.049278839151711.637514009769

\begin{tabular}{lllllllll}
\hline
Demand Forecast \tabularnewline
Point & Forecast & 95% LB & 80% LB & 80% UB & 95% UB \tabularnewline
18 & 478.814478803637 & 255.810455878236 & 332.999985804237 & 624.628971803038 & 701.81850172904 \tabularnewline
19 & 478.814478803637 & 254.698209462649 & 332.272726963560 & 625.356230643715 & 702.930748144626 \tabularnewline
20 & 478.814478803637 & 253.591455722667 & 331.549059590417 & 626.079898016858 & 704.037501884608 \tabularnewline
21 & 478.814478803637 & 252.490114078713 & 330.828930996656 & 626.800026610619 & 705.138843528562 \tabularnewline
22 & 478.814478803637 & 251.394105902374 & 330.112289769921 & 627.516667837354 & 706.234851704901 \tabularnewline
23 & 478.814478803637 & 250.303354450885 & 329.399085730816 & 628.22987187646 & 707.32560315639 \tabularnewline
24 & 478.814478803637 & 249.217784804425 & 328.689269891901 & 628.939687715374 & 708.41117280285 \tabularnewline
25 & 478.814478803637 & 248.137323806058 & 327.982794418428 & 629.646163188847 & 709.491633801217 \tabularnewline
26 & 478.814478803637 & 247.061900004207 & 327.279612590723 & 630.349345016552 & 710.567057603068 \tabularnewline
27 & 478.814478803637 & 245.991443597506 & 326.579678768124 & 631.049278839151 & 711.637514009769 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=75957&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]478.814478803637[/C][C]255.810455878236[/C][C]332.999985804237[/C][C]624.628971803038[/C][C]701.81850172904[/C][/ROW]
[ROW][C]19[/C][C]478.814478803637[/C][C]254.698209462649[/C][C]332.272726963560[/C][C]625.356230643715[/C][C]702.930748144626[/C][/ROW]
[ROW][C]20[/C][C]478.814478803637[/C][C]253.591455722667[/C][C]331.549059590417[/C][C]626.079898016858[/C][C]704.037501884608[/C][/ROW]
[ROW][C]21[/C][C]478.814478803637[/C][C]252.490114078713[/C][C]330.828930996656[/C][C]626.800026610619[/C][C]705.138843528562[/C][/ROW]
[ROW][C]22[/C][C]478.814478803637[/C][C]251.394105902374[/C][C]330.112289769921[/C][C]627.516667837354[/C][C]706.234851704901[/C][/ROW]
[ROW][C]23[/C][C]478.814478803637[/C][C]250.303354450885[/C][C]329.399085730816[/C][C]628.22987187646[/C][C]707.32560315639[/C][/ROW]
[ROW][C]24[/C][C]478.814478803637[/C][C]249.217784804425[/C][C]328.689269891901[/C][C]628.939687715374[/C][C]708.41117280285[/C][/ROW]
[ROW][C]25[/C][C]478.814478803637[/C][C]248.137323806058[/C][C]327.982794418428[/C][C]629.646163188847[/C][C]709.491633801217[/C][/ROW]
[ROW][C]26[/C][C]478.814478803637[/C][C]247.061900004207[/C][C]327.279612590723[/C][C]630.349345016552[/C][C]710.567057603068[/C][/ROW]
[ROW][C]27[/C][C]478.814478803637[/C][C]245.991443597506[/C][C]326.579678768124[/C][C]631.049278839151[/C][C]711.637514009769[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=75957&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75957&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
18478.814478803637255.810455878236332.999985804237624.628971803038701.81850172904
19478.814478803637254.698209462649332.272726963560625.356230643715702.930748144626
20478.814478803637253.591455722667331.549059590417626.079898016858704.037501884608
21478.814478803637252.490114078713330.828930996656626.800026610619705.138843528562
22478.814478803637251.394105902374330.112289769921627.516667837354706.234851704901
23478.814478803637250.303354450885329.399085730816628.22987187646707.32560315639
24478.814478803637249.217784804425328.689269891901628.939687715374708.41117280285
25478.814478803637248.137323806058327.982794418428629.646163188847709.491633801217
26478.814478803637247.061900004207327.279612590723630.349345016552710.567057603068
27478.814478803637245.991443597506326.579678768124631.049278839151711.637514009769







Actuals and Interpolation
TimeActualForecast
1721.8416667NA
2644.5833333721.8416667
3554.4333333714.11583336
4562.9666667698.147583354
5711.675684.6294916886
6531.1083333687.33404251974
7379.95671.711471597766
8336.25642.53532443799
9370.175611.90679199419
10493.0833333587.733612794771
11657.7666667578.268584845294
12533.4583333586.218393030765
13402.2833333580.942387057688
14267.3416667563.07648168192
15447.5416667533.503000183728
16297.7583333524.906866835355
17268.4166667502.19201348182

\begin{tabular}{lllllllll}
\hline
Actuals and Interpolation \tabularnewline
Time & Actual & Forecast \tabularnewline
1 & 721.8416667 & NA \tabularnewline
2 & 644.5833333 & 721.8416667 \tabularnewline
3 & 554.4333333 & 714.11583336 \tabularnewline
4 & 562.9666667 & 698.147583354 \tabularnewline
5 & 711.675 & 684.6294916886 \tabularnewline
6 & 531.1083333 & 687.33404251974 \tabularnewline
7 & 379.95 & 671.711471597766 \tabularnewline
8 & 336.25 & 642.53532443799 \tabularnewline
9 & 370.175 & 611.90679199419 \tabularnewline
10 & 493.0833333 & 587.733612794771 \tabularnewline
11 & 657.7666667 & 578.268584845294 \tabularnewline
12 & 533.4583333 & 586.218393030765 \tabularnewline
13 & 402.2833333 & 580.942387057688 \tabularnewline
14 & 267.3416667 & 563.07648168192 \tabularnewline
15 & 447.5416667 & 533.503000183728 \tabularnewline
16 & 297.7583333 & 524.906866835355 \tabularnewline
17 & 268.4166667 & 502.19201348182 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=75957&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]721.8416667[/C][C]NA[/C][/ROW]
[ROW][C]2[/C][C]644.5833333[/C][C]721.8416667[/C][/ROW]
[ROW][C]3[/C][C]554.4333333[/C][C]714.11583336[/C][/ROW]
[ROW][C]4[/C][C]562.9666667[/C][C]698.147583354[/C][/ROW]
[ROW][C]5[/C][C]711.675[/C][C]684.6294916886[/C][/ROW]
[ROW][C]6[/C][C]531.1083333[/C][C]687.33404251974[/C][/ROW]
[ROW][C]7[/C][C]379.95[/C][C]671.711471597766[/C][/ROW]
[ROW][C]8[/C][C]336.25[/C][C]642.53532443799[/C][/ROW]
[ROW][C]9[/C][C]370.175[/C][C]611.90679199419[/C][/ROW]
[ROW][C]10[/C][C]493.0833333[/C][C]587.733612794771[/C][/ROW]
[ROW][C]11[/C][C]657.7666667[/C][C]578.268584845294[/C][/ROW]
[ROW][C]12[/C][C]533.4583333[/C][C]586.218393030765[/C][/ROW]
[ROW][C]13[/C][C]402.2833333[/C][C]580.942387057688[/C][/ROW]
[ROW][C]14[/C][C]267.3416667[/C][C]563.07648168192[/C][/ROW]
[ROW][C]15[/C][C]447.5416667[/C][C]533.503000183728[/C][/ROW]
[ROW][C]16[/C][C]297.7583333[/C][C]524.906866835355[/C][/ROW]
[ROW][C]17[/C][C]268.4166667[/C][C]502.19201348182[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=75957&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75957&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
1721.8416667NA
2644.5833333721.8416667
3554.4333333714.11583336
4562.9666667698.147583354
5711.675684.6294916886
6531.1083333687.33404251974
7379.95671.711471597766
8336.25642.53532443799
9370.175611.90679199419
10493.0833333587.733612794771
11657.7666667578.268584845294
12533.4583333586.218393030765
13402.2833333580.942387057688
14267.3416667563.07648168192
15447.5416667533.503000183728
16297.7583333524.906866835355
17268.4166667502.19201348182







\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=75957&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=75957&T=3

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75957&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