| lt.dist | R Documentation |
Calculate the empirical quantiles of the demand over the lead time from the cumulative in-sample forecast errors, either for a model fitted with the functions of the package, for any lead time and probabilities without refitting it, or for any forecast that is constant over the horizon.
lt.dist(
data,
frc.in = NULL,
frc.out = NULL,
h = NULL,
probs = c(0.9, 0.95),
qtype = 7
)
data |
A model fitted with |
frc.in |
In-sample forecasts, of the same length as |
frc.out |
Out-of-sample forecast from the end of the sample. Only the first
value is used. Not used when |
h |
Lead time, see the section "Lead time quantiles" in |
probs |
Probabilities of the quantiles. |
qtype |
Type of empirical quantile calculation, passed to
|
This is the calculation used by the forecasting functions of the package
when probs is provided. With a fitted model, the stored series and in-sample
forecasts are used, so the lead time and the probabilities can be changed without
optimising the model again. Note that the parameters of a model optimised with the
cost functions "msce" or "mace" depend on the horizon used when
fitting it. For iMAPA, the forecasts from each in-sample origin are calculated if
they were not calculated when fitting, which can take some time.
With a time series and forecasts produced otherwise, the forecast made at each
origin is assumed to be constant over the next h periods, as is the case for
all methods in the package, so that the cumulative forecast from origin t-1
is h*frc.in[t].
A list containing:
h |
Lead time. |
probs |
Probabilities. |
frc |
Cumulative forecast over the lead time. |
quantile |
Quantiles of the demand over the lead time, i.e., the order-up-to level or the reorder point. |
ss |
Safety stock, i.e., the quantiles minus the cumulative forecast. |
errors |
In-sample cumulative errors. |
origin |
Origin of each cumulative error, i.e., the period at the end of which
the forecast was made, so that the error covers periods |
n |
Number of cumulative errors. |
qtype |
Type of quantile calculation. |
Nikolaos Kourentzes, nikolaos@kourentzes.com
Saoud, P., Kourentzes, N., and Boylan, J. E. (2022). Approximations for the lead time variance: A forecasting and inventory evaluation. Omega, 110, 102614. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.omega.2022.102614")}
crost, forecast.tsint.
# Different lead times and probabilities for a fitted model, without refitting
fit <- crost(ts.data1, type="sba")
lt.dist(fit, h=3)
lt.dist(fit, h=6, probs=0.99)
# Same result as crost(ts.data1, h=3, probs=c(0.9,0.95))$lt
fit <- crost(ts.data1, h=3)
lt.dist(ts.data1, fit$frc.in, fit$frc.out, h=3)
# A simple moving average of the last 12 periods as the forecast
y <- as.numeric(ts.data1)
frc <- c(rep(NA,12), as.numeric(stats::filter(y, rep(1/12,12), sides=1))[12:(length(y)-1)])
lt.dist(y, frc, mean(tail(y,12)), h=3, probs=0.95)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.