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:23:43 +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/t1273760653ont2dlbif7wmu1b.htm/, Retrieved Mon, 06 May 2024 08:58:44 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=75966, Retrieved Mon, 06 May 2024 08:58:44 +0000
QR Codes:

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

Post a new message
Dataseries X:
738,1666667
733,4333333
671,625
696,7083333
678,8
692,6583333
733,8833333
697,5416667
546,4166667
716,1166667
600,2583333
387,8083333
137,25
403,4083333
241,9583333
183,9
91,5




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=75966&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=75966&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75966&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
18474.765356786322129.007766786152248.686620514222700.844093058422820.522946786492
19474.765356786322127.283279330300247.559038774842701.971674797802822.247434242343
20474.765356786322125.567308018034246.437025442449703.093688130195823.96340555461
21474.765356786322123.859727914388245.320498826459704.210214746185825.670985658255
22474.765356786322122.160417109586244.209379214355705.321334358289827.370296463058
23474.765356786322120.469256617464243.103588805264706.42712476738829.06145695518
24474.765356786322118.786130278245242.003051646393707.52766192625830.7445832944
25474.765356786322117.110924665432240.907693572141708.623020000503832.419788907212
26474.765356786322115.443528996604239.817442145776709.713271426867834.08718457604
27474.765356786322113.783835047922238.732226603534710.79848696911835.746878524722

\begin{tabular}{lllllllll}
\hline
Demand Forecast \tabularnewline
Point & Forecast & 95% LB & 80% LB & 80% UB & 95% UB \tabularnewline
18 & 474.765356786322 & 129.007766786152 & 248.686620514222 & 700.844093058422 & 820.522946786492 \tabularnewline
19 & 474.765356786322 & 127.283279330300 & 247.559038774842 & 701.971674797802 & 822.247434242343 \tabularnewline
20 & 474.765356786322 & 125.567308018034 & 246.437025442449 & 703.093688130195 & 823.96340555461 \tabularnewline
21 & 474.765356786322 & 123.859727914388 & 245.320498826459 & 704.210214746185 & 825.670985658255 \tabularnewline
22 & 474.765356786322 & 122.160417109586 & 244.209379214355 & 705.321334358289 & 827.370296463058 \tabularnewline
23 & 474.765356786322 & 120.469256617464 & 243.103588805264 & 706.42712476738 & 829.06145695518 \tabularnewline
24 & 474.765356786322 & 118.786130278245 & 242.003051646393 & 707.52766192625 & 830.7445832944 \tabularnewline
25 & 474.765356786322 & 117.110924665432 & 240.907693572141 & 708.623020000503 & 832.419788907212 \tabularnewline
26 & 474.765356786322 & 115.443528996604 & 239.817442145776 & 709.713271426867 & 834.08718457604 \tabularnewline
27 & 474.765356786322 & 113.783835047922 & 238.732226603534 & 710.79848696911 & 835.746878524722 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=75966&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]474.765356786322[/C][C]129.007766786152[/C][C]248.686620514222[/C][C]700.844093058422[/C][C]820.522946786492[/C][/ROW]
[ROW][C]19[/C][C]474.765356786322[/C][C]127.283279330300[/C][C]247.559038774842[/C][C]701.971674797802[/C][C]822.247434242343[/C][/ROW]
[ROW][C]20[/C][C]474.765356786322[/C][C]125.567308018034[/C][C]246.437025442449[/C][C]703.093688130195[/C][C]823.96340555461[/C][/ROW]
[ROW][C]21[/C][C]474.765356786322[/C][C]123.859727914388[/C][C]245.320498826459[/C][C]704.210214746185[/C][C]825.670985658255[/C][/ROW]
[ROW][C]22[/C][C]474.765356786322[/C][C]122.160417109586[/C][C]244.209379214355[/C][C]705.321334358289[/C][C]827.370296463058[/C][/ROW]
[ROW][C]23[/C][C]474.765356786322[/C][C]120.469256617464[/C][C]243.103588805264[/C][C]706.42712476738[/C][C]829.06145695518[/C][/ROW]
[ROW][C]24[/C][C]474.765356786322[/C][C]118.786130278245[/C][C]242.003051646393[/C][C]707.52766192625[/C][C]830.7445832944[/C][/ROW]
[ROW][C]25[/C][C]474.765356786322[/C][C]117.110924665432[/C][C]240.907693572141[/C][C]708.623020000503[/C][C]832.419788907212[/C][/ROW]
[ROW][C]26[/C][C]474.765356786322[/C][C]115.443528996604[/C][C]239.817442145776[/C][C]709.713271426867[/C][C]834.08718457604[/C][/ROW]
[ROW][C]27[/C][C]474.765356786322[/C][C]113.783835047922[/C][C]238.732226603534[/C][C]710.79848696911[/C][C]835.746878524722[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=75966&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75966&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
18474.765356786322129.007766786152248.686620514222700.844093058422820.522946786492
19474.765356786322127.283279330300247.559038774842701.971674797802822.247434242343
20474.765356786322125.567308018034246.437025442449703.093688130195823.96340555461
21474.765356786322123.859727914388245.320498826459704.210214746185825.670985658255
22474.765356786322122.160417109586244.209379214355705.321334358289827.370296463058
23474.765356786322120.469256617464243.103588805264706.42712476738829.06145695518
24474.765356786322118.786130278245242.003051646393707.52766192625830.7445832944
25474.765356786322117.110924665432240.907693572141708.623020000503832.419788907212
26474.765356786322115.443528996604239.817442145776709.713271426867834.08718457604
27474.765356786322113.783835047922238.732226603534710.79848696911835.746878524722







Actuals and Interpolation
TimeActualForecast
1738.1666667NA
2733.4333333738.1666667
3671.625737.69333336
4696.7083333731.086500024
5678.8727.6486833516
6692.6583333722.76381501644
7733.8833333719.753266844796
8697.5416667721.166273490316
9546.4166667718.803812811285
10716.1166667701.565098200156
11600.2583333703.02025505014
12387.8083333692.744062875127
13137.25662.250489917614
14403.4083333609.750440925853
15241.9583333589.116230163267
16183.9554.400440476941
1791.5517.350396429247

\begin{tabular}{lllllllll}
\hline
Actuals and Interpolation \tabularnewline
Time & Actual & Forecast \tabularnewline
1 & 738.1666667 & NA \tabularnewline
2 & 733.4333333 & 738.1666667 \tabularnewline
3 & 671.625 & 737.69333336 \tabularnewline
4 & 696.7083333 & 731.086500024 \tabularnewline
5 & 678.8 & 727.6486833516 \tabularnewline
6 & 692.6583333 & 722.76381501644 \tabularnewline
7 & 733.8833333 & 719.753266844796 \tabularnewline
8 & 697.5416667 & 721.166273490316 \tabularnewline
9 & 546.4166667 & 718.803812811285 \tabularnewline
10 & 716.1166667 & 701.565098200156 \tabularnewline
11 & 600.2583333 & 703.02025505014 \tabularnewline
12 & 387.8083333 & 692.744062875127 \tabularnewline
13 & 137.25 & 662.250489917614 \tabularnewline
14 & 403.4083333 & 609.750440925853 \tabularnewline
15 & 241.9583333 & 589.116230163267 \tabularnewline
16 & 183.9 & 554.400440476941 \tabularnewline
17 & 91.5 & 517.350396429247 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=75966&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]738.1666667[/C][C]NA[/C][/ROW]
[ROW][C]2[/C][C]733.4333333[/C][C]738.1666667[/C][/ROW]
[ROW][C]3[/C][C]671.625[/C][C]737.69333336[/C][/ROW]
[ROW][C]4[/C][C]696.7083333[/C][C]731.086500024[/C][/ROW]
[ROW][C]5[/C][C]678.8[/C][C]727.6486833516[/C][/ROW]
[ROW][C]6[/C][C]692.6583333[/C][C]722.76381501644[/C][/ROW]
[ROW][C]7[/C][C]733.8833333[/C][C]719.753266844796[/C][/ROW]
[ROW][C]8[/C][C]697.5416667[/C][C]721.166273490316[/C][/ROW]
[ROW][C]9[/C][C]546.4166667[/C][C]718.803812811285[/C][/ROW]
[ROW][C]10[/C][C]716.1166667[/C][C]701.565098200156[/C][/ROW]
[ROW][C]11[/C][C]600.2583333[/C][C]703.02025505014[/C][/ROW]
[ROW][C]12[/C][C]387.8083333[/C][C]692.744062875127[/C][/ROW]
[ROW][C]13[/C][C]137.25[/C][C]662.250489917614[/C][/ROW]
[ROW][C]14[/C][C]403.4083333[/C][C]609.750440925853[/C][/ROW]
[ROW][C]15[/C][C]241.9583333[/C][C]589.116230163267[/C][/ROW]
[ROW][C]16[/C][C]183.9[/C][C]554.400440476941[/C][/ROW]
[ROW][C]17[/C][C]91.5[/C][C]517.350396429247[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=75966&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=75966&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
1738.1666667NA
2733.4333333738.1666667
3671.625737.69333336
4696.7083333731.086500024
5678.8727.6486833516
6692.6583333722.76381501644
7733.8833333719.753266844796
8697.5416667721.166273490316
9546.4166667718.803812811285
10716.1166667701.565098200156
11600.2583333703.02025505014
12387.8083333692.744062875127
13137.25662.250489917614
14403.4083333609.750440925853
15241.9583333589.116230163267
16183.9554.400440476941
1791.5517.350396429247







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

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