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 computationTue, 06 Apr 2010 10:31:08 +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/Apr/06/t1270549970039mea03jwjmj7b.htm/, Retrieved Thu, 25 Apr 2024 23:45:02 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=74606, Retrieved Thu, 25 Apr 2024 23:45:02 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywordsmissing value, b382, steven coomans, thesis
Estimated Impact233
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-       [Croston Forecasting] [missing value b382] [2010-04-06 10:31:08] [d41d8cd98f00b204e9800998ecf8427e] [Current]
Feedback Forum

Post a new message
Dataseries X:
429.75
247.325
395.15
293.905
299.125
211.375
275.25
253.25
250.5
285.8
276
300.75
309.25
309.25
336.25
331.25
331.25
308.75
230.725
330.5
224.5
197.125
306.25
235.125
322.25
280.625
232.25
317.75
317.75
232.25
319.5
265.25
203.5
168.85
295.75
312.2
335.25
261.5
305.75
230
230
247.25
276.25
356.3
320.5
188.5
372.75
296
329.5
376.53
281.5
390
0
203.25
337
214.775
270
280
309.25
347
214.575
213.62
231.75
224.3
278
226.525
360.302
263.25
263.75
269.775
283.25
286.75
230.25
200.5
297.95
329.5
289.75
223.775
281.78
265.8
256.75
89.275
225.5
124.25




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time4 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 & 4 seconds \tabularnewline
R Server & wessa.org @ wessa.org \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=74606&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]4 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]wessa.org @ wessa.org[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=74606&T=0

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







Demand Forecast
PointForecast95% LB80% LB80% UB95% UB
85236.251135912406112.799234007707155.530276037752316.971995787060359.703037817105
86236.251135912406112.183509979101155.127675735386317.374596089426360.31876184571
87236.251135912406111.570826618736154.727063619116317.775208205696360.931445206076
88236.251135912406110.961139318886154.328410521519318.173861303292361.541132505925
89236.251135912406110.354404551965153.931687981436318.570583843375362.147867272846
90236.251135912406109.750579834253153.536868220256318.965403604556362.751691990558
91236.251135912406109.149623691187153.143924119218319.358347705593363.352648133625
92236.251135912406108.551495624112152.752829197678319.749442627133363.950776200699
93236.251135912406107.956156078437152.363557592277320.138714232535364.546115746375
94236.251135912406107.363566413104151.976084036985320.526187787826365.138705411708

\begin{tabular}{lllllllll}
\hline
Demand Forecast \tabularnewline
Point & Forecast & 95% LB & 80% LB & 80% UB & 95% UB \tabularnewline
85 & 236.251135912406 & 112.799234007707 & 155.530276037752 & 316.971995787060 & 359.703037817105 \tabularnewline
86 & 236.251135912406 & 112.183509979101 & 155.127675735386 & 317.374596089426 & 360.31876184571 \tabularnewline
87 & 236.251135912406 & 111.570826618736 & 154.727063619116 & 317.775208205696 & 360.931445206076 \tabularnewline
88 & 236.251135912406 & 110.961139318886 & 154.328410521519 & 318.173861303292 & 361.541132505925 \tabularnewline
89 & 236.251135912406 & 110.354404551965 & 153.931687981436 & 318.570583843375 & 362.147867272846 \tabularnewline
90 & 236.251135912406 & 109.750579834253 & 153.536868220256 & 318.965403604556 & 362.751691990558 \tabularnewline
91 & 236.251135912406 & 109.149623691187 & 153.143924119218 & 319.358347705593 & 363.352648133625 \tabularnewline
92 & 236.251135912406 & 108.551495624112 & 152.752829197678 & 319.749442627133 & 363.950776200699 \tabularnewline
93 & 236.251135912406 & 107.956156078437 & 152.363557592277 & 320.138714232535 & 364.546115746375 \tabularnewline
94 & 236.251135912406 & 107.363566413104 & 151.976084036985 & 320.526187787826 & 365.138705411708 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=74606&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]85[/C][C]236.251135912406[/C][C]112.799234007707[/C][C]155.530276037752[/C][C]316.971995787060[/C][C]359.703037817105[/C][/ROW]
[ROW][C]86[/C][C]236.251135912406[/C][C]112.183509979101[/C][C]155.127675735386[/C][C]317.374596089426[/C][C]360.31876184571[/C][/ROW]
[ROW][C]87[/C][C]236.251135912406[/C][C]111.570826618736[/C][C]154.727063619116[/C][C]317.775208205696[/C][C]360.931445206076[/C][/ROW]
[ROW][C]88[/C][C]236.251135912406[/C][C]110.961139318886[/C][C]154.328410521519[/C][C]318.173861303292[/C][C]361.541132505925[/C][/ROW]
[ROW][C]89[/C][C]236.251135912406[/C][C]110.354404551965[/C][C]153.931687981436[/C][C]318.570583843375[/C][C]362.147867272846[/C][/ROW]
[ROW][C]90[/C][C]236.251135912406[/C][C]109.750579834253[/C][C]153.536868220256[/C][C]318.965403604556[/C][C]362.751691990558[/C][/ROW]
[ROW][C]91[/C][C]236.251135912406[/C][C]109.149623691187[/C][C]153.143924119218[/C][C]319.358347705593[/C][C]363.352648133625[/C][/ROW]
[ROW][C]92[/C][C]236.251135912406[/C][C]108.551495624112[/C][C]152.752829197678[/C][C]319.749442627133[/C][C]363.950776200699[/C][/ROW]
[ROW][C]93[/C][C]236.251135912406[/C][C]107.956156078437[/C][C]152.363557592277[/C][C]320.138714232535[/C][C]364.546115746375[/C][/ROW]
[ROW][C]94[/C][C]236.251135912406[/C][C]107.363566413104[/C][C]151.976084036985[/C][C]320.526187787826[/C][C]365.138705411708[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=74606&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=74606&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
85236.251135912406112.799234007707155.530276037752316.971995787060359.703037817105
86236.251135912406112.183509979101155.127675735386317.374596089426360.31876184571
87236.251135912406111.570826618736154.727063619116317.775208205696360.931445206076
88236.251135912406110.961139318886154.328410521519318.173861303292361.541132505925
89236.251135912406110.354404551965153.931687981436318.570583843375362.147867272846
90236.251135912406109.750579834253153.536868220256318.965403604556362.751691990558
91236.251135912406109.149623691187153.143924119218319.358347705593363.352648133625
92236.251135912406108.551495624112152.752829197678319.749442627133363.950776200699
93236.251135912406107.956156078437152.363557592277320.138714232535364.546115746375
94236.251135912406107.363566413104151.976084036985320.526187787826365.138705411708







\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=74606&T=2

[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=74606&T=2

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

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 = Croston ; par3 = NA ; par4 = NA ; par5 = ZZZ ; par6 = 1 ; par8 = dumresult ; par9 = 1 ; par10 = 0.1 ;
Parameters (R input):
par1 = Input box ; par2 = Croston ; par3 = NA ; par4 = NA ; par5 = ZZZ ; par6 = 1 ; par7 = ; par8 = dumresult ; par9 = 1 ; 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,'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#output',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