Title: | Time Series Exploration, Modelling and Forecasting |
---|---|
Description: | Includes: (i) tests and visualisations that can help the modeller explore time series components and perform decomposition; (ii) modelling shortcuts, such as functions to construct lagmatrices and seasonal dummy variables of various forms; (iii) an implementation of the Theta method; (iv) tools to facilitate the design of the forecasting process, such as ABC-XYZ analyses; and (v) "quality of life" functions, such as treating time series for trailing and leading values. |
Authors: | Nikolaos Kourentzes [aut, cre], Ivan Svetunkov [ctb], Oliver Schaer [ctb] |
Maintainer: | Nikolaos Kourentzes <[email protected]> |
License: | GPL-3 |
Version: | 0.9.4 |
Built: | 2025-02-17 05:17:03 UTC |
Source: | https://github.com/trnnick/tsutils |
Perform ABC analysis on a set of time series.
abc(x, prc = c(0.2, 0.3, 0.5)) ## S3 method for class 'abc' plot(x, cex.prc = 0.8, ...)
abc(x, prc = c(0.2, 0.3, 0.5)) ## S3 method for class 'abc' plot(x, cex.prc = 0.8, ...)
x |
this can either be an array, where each column is a series, or a vector of values. If |
prc |
a vector of percentages indicating how many items are included in each class. By default this is |
cex.prc |
font size of percentages reported in plot. |
... |
additional arguments passed to the plot. |
Return object of class abc
and contains:
value
: a vector containing the importance value of each series.
class
: a vector containing the class membership of each series.
rank
: a vector containing the rank of each series, with 1 being the highest ranking series.
conc
: the importance concentration of each class, as percentage of total value.
plot(abc)
: plot ABC or XYZ analyses.
Nikolaos Kourentzes, [email protected].
Ord K., Fildes R., Kourentzes N. (2017) Principles of Business Forecasting, 2e. Wessex Press Publishing Co., p.515-518.
x <- abs(matrix(cumsum(rnorm(5400,0,1)),36,150)) z <- abc(x) print(z) plot(z)
x <- abs(matrix(cumsum(rnorm(5400,0,1)),36,150)) z <- abc(x) print(z) plot(z)
Jointly visualise ABC and XYZ analyses.
abcxyz(imp, frc, outplot = c(TRUE, FALSE), error = NULL, ...)
abcxyz(imp, frc, outplot = c(TRUE, FALSE), error = NULL, ...)
imp |
an obkect of class |
frc |
an obkect of class |
outplot |
if |
error |
vector of forecast errors for each series that will be distributed in each class, presented as an average. |
... |
additional arguments passed to the plot. |
A list containing:
class
: a matrix containing the number of time series in each class.
error
: a matrix containing the averaged error for each class, if the argument error
was used.
Nikolaos Kourentzes, [email protected].
Ord K., Fildes R., Kourentzes N. (2017) Principles of Business Forecasting, 2e. Wessex Press Publishing Co., p.515-518.
x <- abs(matrix(cumsum(rnorm(5400,0,1)),36,150)) abcxyz(abc(x),xyz(x,type="cv"))
x <- abs(matrix(cumsum(rnorm(5400,0,1)),36,150)) abcxyz(abc(x),xyz(x,type="cv"))
Calculate the Centred Moving Average (CMA) for time series.
cmav( y, ma = NULL, fill = c(TRUE, FALSE), outplot = c(FALSE, TRUE), fast = c(TRUE, FALSE) )
cmav( y, ma = NULL, fill = c(TRUE, FALSE), outplot = c(FALSE, TRUE), fast = c(TRUE, FALSE) )
y |
input time series. Can be |
ma |
length of centred moving average. If |
fill |
if |
outplot |
if |
fast |
if |
Centred moving average. If y is a ts object, then cma has the same properties.
Nikolaos Kourentzes, [email protected].
Ord K., Fildes R., Kourentzes N. (2017) Principles of Business Forecasting, 2e. Wessex Press Publishing Co., p.109.
cmav(referrals,outplot=TRUE)
cmav(referrals,outplot=TRUE)
Perform Cox-Stuart test for location or dispersion.
coxstuart(y, type = c("trend", "deviation", "dispersion"), alpha = 0.05)
coxstuart(y, type = c("trend", "deviation", "dispersion"), alpha = 0.05)
y |
input data. |
type |
type of test. Can be:
|
alpha |
significance level. |
A list containing:
H
: hypothesis outcome.
p.value
: corresponding p-value.
Htxt
: textual description of the hypothesis outcome.
Nikolaos Kourentzes, [email protected].
coxstuart(referrals)
coxstuart(referrals)
Perform classical time series decomposition.
decomp( y, m = NULL, s = NULL, trend = NULL, outplot = c(FALSE, TRUE), decomposition = c("multiplicative", "additive", "auto"), h = 0, type = c("mean", "median", "pure.seasonal"), w = NULL )
decomp( y, m = NULL, s = NULL, trend = NULL, outplot = c(FALSE, TRUE), decomposition = c("multiplicative", "additive", "auto"), h = 0, type = c("mean", "median", "pure.seasonal"), w = NULL )
y |
input time series. Can be |
m |
seasonal period. If |
s |
starting period in the season. If |
trend |
vector of the level/trend of |
outplot |
if |
decomposition |
type of decomposition. This can be |
h |
forecast horizon for seasonal component. |
type |
calculation for seasonal component:
|
w |
percentage or number of observations to winsorise in the calculation of mean seasonal indices. If w>1 then it is the number of observations, otherwise it is a percentage. If |
A list containing:
trend
: trend component.
season
: season component.
irregular
: irregular component.
f.season
: forecasted seasonal component if h>0
.
g
: pure seasonal model parameters.
Nikolaos Kourentzes, [email protected].
Ord K., Fildes R., Kourentzes N. (2017) Principles of Business Forecasting, 2e. Wessex Press Publishing Co., p.106-111.
decomp(referrals)
decomp(referrals)
Calculate the geometric mean.
geomean(x, na.rm = c(FALSE, TRUE), ...)
geomean(x, na.rm = c(FALSE, TRUE), ...)
x |
input data (will be considered as a vector). |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
... |
further arguments passed to or from other methods. |
The geometirc mean of the values in x
.
Nikolaos Kourentzes, [email protected].
geomean(c(0.5,1,1.5))
geomean(c(0.5,1,1.5))
Calculate the theoretically optimal temporal aggregation level for AR(1), MA(1) and ARMA(1,1) time series.
getOptK(y, m = 12, type = c("ar", "ma", "arma"))
getOptK(y, m = 12, type = c("ar", "ma", "arma"))
y |
a time series that must be of either |
m |
maximum aggregation level. |
type |
type of data generating process. Can be:
|
Identified optimal temporal aggregation level.
Nikolaos Kourentzes, [email protected].
Kourentzes, N., Rostami-Tabar, B., & Barrow, D. K. (2017). Demand forecasting by temporal aggregation: using optimal or multiple aggregation levels?. Journal of Business Research, 78, 1-9.
Rostami-Tabar, B., Babai, M. Z., Syntetos, A., & Ducq, Y. (2013). Demand forecasting by temporal aggregation. Naval Research Logistics (NRL), 60(6), 479-498.
Rostami-Tabar, B., Babai, M. Z., Syntetos, A., & Ducq, Y. (2014). A note on the forecast performance of temporal aggregation. Naval Research Logistics (NRL), 61(7), 489-500.
getOptK(referrals)
getOptK(referrals)
Create an array with lead/lags of an input variable.
lagmatrix(x, lag)
lagmatrix(x, lag)
x |
input variable. |
lag |
vector of leads and lags. Positive numbers are lags, negative are leads. O is the original |
An array with the resulting leads and lags (columns).
Nikolaos Kourentzes, [email protected]
x <- rnorm(10) lagmatrix(x,c(0,1,-1))
x <- rnorm(10) lagmatrix(x,c(0,1,-1))
Calculates the lambdaMax
value, which is the penalty term (lambda) beyond which coefficients are guaranteed to be all zero and provides a sequence of nLambda
values to lambdaMin
in logarithmic descent.
lambdaseq( x, y, weight = NA, alpha = 1, standardise = TRUE, lambdaRatio = 1e-04, nLambda = 100, addZeroLambda = FALSE )
lambdaseq( x, y, weight = NA, alpha = 1, standardise = TRUE, lambdaRatio = 1e-04, nLambda = 100, addZeroLambda = FALSE )
x |
matrix of regressors. See |
y |
response variable. See |
weight |
vector of |
alpha |
elastic net mixing value. See |
standardise |
if |
lambdaRatio |
ratio between |
nLambda |
length of the lambda sequence. |
addZeroLambda |
if |
A list that contains:
lambda
: sequence of lambda values, from lambdaMax
to lambdaMin
.
lambdaMin
: minimal lambda value.
lambdaMax
: maximal lambda value.
nullMSE
: MSE of the fit using just a constant term.
Oliver Schaer, [email protected],
Nikolaos Kourentzes, [email protected].
Hastie, T., Tibshirani, R., & Wainwright, M. (2015). Statistical learning with sparsity: the lasso and generalizations. CRC press.
y <- mtcars[,1] x <- as.matrix(mtcars[,2:11]) lambda <- lambdaseq(x, y)$lambda ## Not run: library(glmnet) fit.lasso <- cv.glmnet(x, y, lambda = lambda) coef.lasso <- coef(fit.lasso, s = "lambda.1se") ## End(Not run)
y <- mtcars[,1] x <- as.matrix(mtcars[,2:11]) lambda <- lambdaseq(x, y)$lambda ## Not run: library(glmnet) fit.lasso <- cv.glmnet(x, y, lambda = lambda) coef.lasso <- coef(fit.lasso, s = "lambda.1se") ## End(Not run)
Remove leading or trailing zeros or NAs from a vector.
leadtrail( x, rm = c("zeros", "na"), lead = c(TRUE, FALSE), trail = c(TRUE, FALSE) )
leadtrail( x, rm = c("zeros", "na"), lead = c(TRUE, FALSE), trail = c(TRUE, FALSE) )
x |
vector of values to check. |
rm |
what to remove, can be |
lead |
If |
trail |
If |
Resulting vector.
Nikolaos Kourentzes, [email protected].
x <- c(rep(0,5),rnorm(100),rep(0,5)) leadtrail(x)
x <- c(rep(0,5),rnorm(100),rep(0,5)) leadtrail(x)
Perform nonparametric multiple comparisons, across columns, using the Friedman and the post-hoc Nemenyi tests.
nemenyi( data, conf.level = 0.95, sort = c(TRUE, FALSE), plottype = c("vline", "none", "mcb", "vmcb", "line", "matrix"), select = NULL, labels = NULL, ... )
nemenyi( data, conf.level = 0.95, sort = c(TRUE, FALSE), plottype = c("vline", "none", "mcb", "vmcb", "line", "matrix"), select = NULL, labels = NULL, ... )
data |
an array that includes values to be compared for several treatments (in columns) for several observations (rows), of size n x k. For example, if these are forecast errors, different methods should be in columns and errors for different time series or forecast origins in rows. |
conf.level |
the confidence level used for the comparison. Default is 0.95. |
sort |
if |
plottype |
type of plot to produce:
|
select |
highlight selected treatment (column). Number 1 to k. Use NULL for no highlighting. |
labels |
optional labels for models. If NULL column names of |
... |
additional arguments passed to the |
Return object of class nemenyi
and contains:
means
: mean rank of each treatment.
intervals
: intervals within there is no evidence of significance difference according to the Nemenyi test at requested confidence level.
fpavl
: Friedman test p-value.
fH
: Friedman test hypothesis outcome.
cd
: Nemenyi critical distance. Output intervals
is calculate as means
+/- cd
.
conf.level
: confidence level used for testing.
k
: number of treatments (columns).
n
: number of observations (rows).
Nikolaos Kourentzes, [email protected],
Ivan Svetunkov, [email protected].
The tests are deailed by Hollander, M., Wolfe, D.A. and Chicken, E. (2014) Nonparametric Statistical Methods. 3rd Edition, John Wiley & Sons, Inc., New York.
The line plot is introduced here and a first example of its use, along with a short description is provided by Kourentzes, N. (2013). Intermittent demand forecasts with neural networks. International Journal of Production Economics, 143(1), 198-206.
The matrix plot is introduced by Kourentzes, N., & Athanasopoulos, G. (2018). Cross-temporal coherent forecasts for Australian tourism (No. 24/18). Monash University, Department of Econometrics and Business Statistics.
The MCB plot is described by Koning, A. J., Franses, P. H., Hibon, M., & Stekler, H. O. (2005). The M3 competition: Statistical tests of the results. International Journal of Forecasting, 21(3), 397-409.
x <- matrix( rnorm(50*4,mean=0,sd=1), 50, 4) x[,2] <- x[,2]+1 x[,3] <- x[,3]+0.7 x[,4] <- x[,4]+0.5 colnames(x) <- c("Method A","Method B","Method C - long name","Method D") nemenyi(x,conf.level=0.95,plottype="vline")
x <- matrix( rnorm(50*4,mean=0,sd=1), 50, 4) x[,2] <- x[,2]+1 x[,3] <- x[,3]+0.7 x[,4] <- x[,4]+0.5 colnames(x) <- c("Method A","Method B","Method C - long name","Method D") nemenyi(x,conf.level=0.95,plottype="vline")
Plots the temporal hierarchy for a given time series of seasonal periodicity.
plotSthief(y, labels = c(TRUE, FALSE), ...)
plotSthief(y, labels = c(TRUE, FALSE), ...)
y |
input time series (a |
labels |
if |
... |
additional arguments passed to the plotting function. |
Produces a plot of the temporal hierarchy.
Nikolaos Kourentzes, [email protected].
Athanasopoulos, G., Hyndman, R. J., Kourentzes, N., & Petropoulos, F. (2017). Forecasting with temporal hierarchies. European Journal of Operational Research, 262(1), 60-74.
plotSthief(AirPassengers)
plotSthief(AirPassengers)
Monthly Accident & Emergency referrals for England and Wales.
https://www.england.nhs.uk/statistics/statistical-work-areas/ae-waiting-times-and-activity/
Create a control chart of residuals and identify outliers.
residout(resid, t = 2, outplot = c(TRUE, FALSE))
residout(resid, t = 2, outplot = c(TRUE, FALSE))
resid |
vector of residuals. |
t |
threshold value over which standardised residuals are regarded as outliers. |
outplot |
if |
A list containing:
location
: locations of outliers.
outliers
: values of outliers.
residuals
: standardised residuals.
Nikolaos Kourentzes, [email protected].
residout(rnorm(50), outplot=TRUE)
residout(rnorm(50), outplot=TRUE)
Create binary or trigonometric seasonal dummies.
seasdummy(n, m = NULL, y = NULL, type = c("bin", "trg"), full = c(FALSE, TRUE))
seasdummy(n, m = NULL, y = NULL, type = c("bin", "trg"), full = c(FALSE, TRUE))
n |
number of observations to create. |
m |
seasonal periodicity. If |
y |
this is an optional time series input that can be used to get seasonal periodicity ( |
type |
type of seasonal dummies to create.
|
full |
If full is |
An array with seasonal dummies, where rows correspond observations and columns to dummy variables.
If the seasonal periodicity is fractional then the the type will be overriden to trigonometric and only two seasonal dummies with be produced. One cosine and one sine.
Nikolaos Kourentzes, [email protected]
seasdummy(24,12)
seasdummy(24,12)
Construct seasonal plots of various styles for a given time series. The series can automatically detrended as needed.
seasplot( y, m = NULL, s = NULL, trend = NULL, colour = NULL, alpha = 0.05, outplot = c(1, 0, 2, 3, 4, 5), decomposition = c("multiplicative", "additive", "auto"), cma = NULL, labels = NULL, ... )
seasplot( y, m = NULL, s = NULL, trend = NULL, colour = NULL, alpha = 0.05, outplot = c(1, 0, 2, 3, 4, 5), decomposition = c("multiplicative", "additive", "auto"), cma = NULL, labels = NULL, ... )
y |
input time series. Can be |
m |
seasonal period. If |
s |
starting period in the season. If |
trend |
if |
colour |
single colour override for plots. |
alpha |
significance level for statistical tests. |
outplot |
type of seasonal plot
|
decomposition |
type of seasonal decomposition. This can be |
cma |
input precalculated level/trend for the analysis. This overrides |
labels |
external labels for the seasonal periods. Use |
... |
additional arguments passed to plotting functions. For example, use |
An object of class seasexpl
containing:
season
: matrix of (detrended) seasonal elements.
season.exist
: TRUE
/FALSE
results of seasonality test.
season.pval
: p-value of seasonality test (Friedman test).
trend
: CMA estimate (using cmav
) or NULL
if trend=FALSE
.
trend.exist
: TRUE
/FALSE
results of trend test.
trend.pval
: p-value of trend test (Cox-Stuart).
decomposition
: type of decomposition used.
Nikolaos Kourentzes, [email protected].
seasplot(referrals,outplot=1)
seasplot(referrals,outplot=1)
Calculate the temporal hierarchy summing matrix S for a given time series of seasonal periodicity.
Sthief(y)
Sthief(y)
y |
input time series (a |
S matrix.
Nikolaos Kourentzes, [email protected].
Athanasopoulos, G., Hyndman, R. J., Kourentzes, N., & Petropoulos, F. (2017). Forecasting with temporal hierarchies. European Journal of Operational Research, 262(1), 60-74.
Sthief(AirPassengers)
Sthief(AirPassengers)
Estimate Theta method.
Forecast with fitted Theta method.
Produce a plot of the fitted Theta method.
theta( y, m = NULL, sign.level = 0.05, cost0 = c("MSE", "MdSE", "MAE", "MdAE"), cost2 = c("MSE", "MdSE", "MAE", "MdAE"), costs = c("MSE", "MdSE", "MAE", "MdAE"), multiplicative = c("multiplicative", "additive", "auto"), cma = NULL, outliers = NULL ) ## S3 method for class 'theta' forecast(object, h = NULL, ...) ## S3 method for class 'theta' plot(x, thetalines = c(TRUE, FALSE), ...) theta.thief(y, h = NULL, ...)
theta( y, m = NULL, sign.level = 0.05, cost0 = c("MSE", "MdSE", "MAE", "MdAE"), cost2 = c("MSE", "MdSE", "MAE", "MdAE"), costs = c("MSE", "MdSE", "MAE", "MdAE"), multiplicative = c("multiplicative", "additive", "auto"), cma = NULL, outliers = NULL ) ## S3 method for class 'theta' forecast(object, h = NULL, ...) ## S3 method for class 'theta' plot(x, thetalines = c(TRUE, FALSE), ...) theta.thief(y, h = NULL, ...)
y |
input time series. Can be |
m |
seasonal period. If |
sign.level |
significance level for trend and seasonality tests. |
cost0 |
cost function of theta0 line. Can be:
|
cost2 |
cost function of theta2 line. Same options as |
costs |
cost function of seasonal element. Same options as |
multiplicative |
type of seasonal decomposition. This can be |
cma |
input precalculated level/trend for the analysis. Use |
outliers |
provide vector of location of observations that are considered outliers (see |
object |
object of class |
h |
forecast horizon. If |
... |
additional arguments passed to functions. |
x |
object of class |
thetalines |
if |
This implementation of the Theta method tests automatically for seasonality and trend. Seasonal decomposition can be done either additively or multiplicatively and the seasonality is treated as a pure seasonal model. The various Theta components can be optimised using different cost functions. The originally proposed Theta method always assumed multiplicative seasonality and presence of trend, while all theta lines were optimised using MSE and seasonality was estimated using classical decomposition.
An object of class theta
, containing:
"method"
: "Theta".
"y"
: the input time series.
"m"
: seasonal periods.
"exist"
: Statistical testing results, exist[1]
is the result for trend, exist[2]
is for season.
"multiplicative"
: If TRUE
, then seasonality is modelled multiplicatively.
"theta0"
: fitted theta0 line values.
"theta2"
: fitted theta2 line values.
"season"
: fitted season values.
"x.out"
: modelled outliers.
"cost"
: cost functions for theta0, theta2 and season components.
"a"
: SES parameters of theta2.
"b"
: regression parameters of theta0.
"p"
: coefficients of outliers from theta0 and theta2 estimation.
"g"
: pure seasonal exponential smoothing parameters.
"fitted"
: fitted values.
"residuals"
: in-sample residuals.
"MSE"
: in-sample Mean Squared Error.
theta.thief()
: Wrapper function to use Theta with thief
.
Nikolaos Kourentzes, [email protected].
The original Theta method was proposed by: Assimakopoulos, V., & Nikolopoulos, K. (2000). The theta model: a decomposition approach to forecasting. International journal of forecasting, 16(4), 521-530. See details in how the implementation here differs.
The THieF forecasting methodology used for theta.thief
is proposed by: Athanasopoulos, G., Hyndman, R. J., Kourentzes, N., & Petropoulos, F. (2017). Forecasting with temporal hierarchies. European Journal of Operational Research, 262(1), 60-74.
fit <- theta(referrals) plot(fit) forecast.theta(fit,h=12) # Or simply use forecast(fit) ## Not run: library(thief) thief(referrals,forecastfunction=theta.thief) ## End(Not run)
fit <- theta(referrals) plot(fit) forecast.theta(fit,h=12) # Or simply use forecast(fit) ## Not run: library(thief) thief(referrals,forecastfunction=theta.thief) ## End(Not run)
Test a time series for trend by either fitting exponential smoothing models and comparing then using the AICc, or by using the non-parametric Cox-Stuart test. The tests can be augmented by using multiple temporal aggregation.
trendtest( y, extract = c("FALSE", "TRUE"), type = c("aicc", "cs"), mta = c(FALSE, TRUE) )
trendtest( y, extract = c("FALSE", "TRUE"), type = c("aicc", "cs"), mta = c(FALSE, TRUE) )
y |
a time series that must be of either |
extract |
if |
type |
type of test. Can be:
|
mta |
If |
All tests are performed at 5
The function returns TRUE
when there is evidence of trend and FALSE
otherwise.
Nikolaos Kourentzes, [email protected].
The multiple temporal aggregation follows the construction approach suggested by Kourentzes, N., Petropoulos, F., & Trapero, J. R. (2014). Improving forecasting by estimating time series structural components across multiple frequencies. International Journal of Forecasting, 30(2), 291-302.
trendtest(referrals,TRUE)
trendtest(referrals,TRUE)
The tsutils package provides functions to support various aspects of time series and forecasting modelling. In particular this package includes: (i) tests and visualisations that can help the modeller explore time series components and perform decomposition; (ii) modelling shortcuts, such as functions to construct lagmatrices and seasonal dummy variables of various forms; (iii) an implementation of the Theta method; (iv) tools to facilitate the design of the forecasting process, such as ABC-XYZ analyses; and (v) "quality of life" tools, such as treating time series for trailing and leading values.
cmav
: centred moving average.
coxstuart
: Cox-Stuart test for location/dispersion.
decomp
: classical time series decomposition.
seasplot
: construct seasonal plots.
trendtest
: test a time series for trend.
getOptK
: optimal temporal aggregation level for AR(1), MA(1), ARMA(1,1).
lagmatrix
: create leads/lags of variable.
nemenyi
: nonparametric multiple comparisons.
residout
: construct control chart of residuals.
seasdummy
: create seasonal dummies.
theta
: Theta method.
Sthief
: temporal hierarchy S matrix.
plotSthief
: plot temporal hierarchy S matrix.
geomean
: geometric mean.
lambdaseq
: generate sequence of lambda for LASSO regression.
leadtrail
: remove leading/training zeros/NAs.
wins
: winsorisation, including vectorised versions colWins
and rowWins
.
referrals
: A&E monthly referrals.
Winsorise either by number or percentage of observations.
wins(x, p = 0.05) colWins(x, p = 0.05) rowWins(x, p = 0.05)
wins(x, p = 0.05) colWins(x, p = 0.05) rowWins(x, p = 0.05)
x |
input data. NAs will be removed. |
p |
percentage or number of observations to be winsorised. If value is <1 then it is used as a percentages. Otherwise it is the number of observations to winsorise. If the resulting p > floor((length(x)-1)/2), then it is set equal to floor((length(x)-1)/2). |
Winsorised vector.
colWins()
: Vectorised version of wins by columns.
rowWins()
: Vectorised version of wins by rows.
Nikolaos Kourentzes, [email protected].
x <- rnorm(100,mean=0,sd=1) xW <- wins(x)
x <- rnorm(100,mean=0,sd=1) xW <- wins(x)
Perform XYZ analysis on a set of time series.
xyz(x, m = NULL, prc = c(0.2, 0.3, 0.5), type = c("naive", "ets", "cv"))
xyz(x, m = NULL, prc = c(0.2, 0.3, 0.5), type = c("naive", "ets", "cv"))
x |
this can either be an array, where each column is a series, or a vector of values. If |
m |
seasonal length for time series. Required when type is |
prc |
a vector of percentages indicating how many items are included in each class. By default this is |
type |
the type of forecastability calculation. This can be:
|
Return object of class abc
and contains:
value
: a vector containing the forecastability value of each series.
class
: a vector containing the class membership of each series.
rank
: a vector containing the rank of each series, with 1 being the lowest forecastability series.
conc
: the forecastability concentration of each class, as percentage of total value.
model
: fitted model for each series.
Nikolaos Kourentzes, [email protected].
Ord K., Fildes R., Kourentzes N. (2017) Principles of Business Forecasting, 2e. Wessex Press Publishing Co., p.515-518.
x <- abs(matrix(cumsum(rnorm(5400,0,1)),36,150)) z <- xyz(x,m=12) print(z) plot(z)
x <- abs(matrix(cumsum(rnorm(5400,0,1)),36,150)) z <- xyz(x,m=12) print(z) plot(z)