Type: | Package |
Title: | Time Series Exploration, Modelling and Forecasting |
Version: | 0.9.4 |
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. |
Imports: | RColorBrewer, forecast, MAPA, plotrix |
Suggests: | thief |
License: | GPL-3 |
Encoding: | UTF-8 |
LazyData: | true |
URL: | https://github.com/trnnick/tsutils/ |
RoxygenNote: | 7.2.3 |
NeedsCompilation: | no |
Packaged: | 2023-11-14 23:19:17 UTC; Nikos |
Author: | Nikolaos Kourentzes [aut, cre], Ivan Svetunkov [ctb], Oliver Schaer [ctb] |
Maintainer: | Nikolaos Kourentzes <nikolaos@kourentzes.com> |
Repository: | CRAN |
Date/Publication: | 2023-11-15 00:20:02 UTC |
tsutils: 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.
Author(s)
Maintainer: Nikolaos Kourentzes nikolaos@kourentzes.com
Other contributors:
Ivan Svetunkov ivan@svetunkov.ru [contributor]
Oliver Schaer info@oliverschaer.ch [contributor]
See Also
Useful links:
Temporal hierarchy S matrix
Description
Calculate the temporal hierarchy summing matrix S for a given time series of seasonal periodicity.
Usage
Sthief(y)
Arguments
y |
input time series (a |
Value
S matrix.
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com.
References
Athanasopoulos, G., Hyndman, R. J., Kourentzes, N., & Petropoulos, F. (2017). Forecasting with temporal hierarchies. European Journal of Operational Research, 262(1), 60-74.
Examples
Sthief(AirPassengers)
ABC analysis
Description
Perform ABC analysis on a set of time series.
Usage
abc(x, prc = c(0.2, 0.3, 0.5))
## S3 method for class 'abc'
plot(x, cex.prc = 0.8, ...)
Arguments
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. |
Value
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.
Methods (by generic)
-
plot(abc)
: plot ABC or XYZ analyses.
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com.
References
Ord K., Fildes R., Kourentzes N. (2017) Principles of Business Forecasting, 2e. Wessex Press Publishing Co., p.515-518.
See Also
Examples
x <- abs(matrix(cumsum(rnorm(5400,0,1)),36,150))
z <- abc(x)
print(z)
plot(z)
ABC-XYZ visualisation
Description
Jointly visualise ABC and XYZ analyses.
Usage
abcxyz(imp, frc, outplot = c(TRUE, FALSE), error = NULL, ...)
Arguments
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. |
Value
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 argumenterror
was used.
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com.
References
Ord K., Fildes R., Kourentzes N. (2017) Principles of Business Forecasting, 2e. Wessex Press Publishing Co., p.515-518.
See Also
Examples
x <- abs(matrix(cumsum(rnorm(5400,0,1)),36,150))
abcxyz(abc(x),xyz(x,type="cv"))
Centred moving average
Description
Calculate the Centred Moving Average (CMA) for time series.
Usage
cmav(
y,
ma = NULL,
fill = c(TRUE, FALSE),
outplot = c(FALSE, TRUE),
fast = c(TRUE, FALSE)
)
Arguments
y |
input time series. Can be |
ma |
length of centred moving average. If |
fill |
if |
outplot |
if |
fast |
if |
Value
Centred moving average. If y is a ts object, then cma has the same properties.
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com.
References
Ord K., Fildes R., Kourentzes N. (2017) Principles of Business Forecasting, 2e. Wessex Press Publishing Co., p.109.
Examples
cmav(referrals,outplot=TRUE)
Cox-Stuart test
Description
Perform Cox-Stuart test for location or dispersion.
Usage
coxstuart(y, type = c("trend", "deviation", "dispersion"), alpha = 0.05)
Arguments
y |
input data. |
type |
type of test. Can be:
|
alpha |
significance level. |
Value
A list containing:
-
H
: hypothesis outcome. -
p.value
: corresponding p-value. -
Htxt
: textual description of the hypothesis outcome.
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com.
Examples
coxstuart(referrals)
Classical time series decomposition
Description
Perform classical time series decomposition.
Usage
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
)
Arguments
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 |
Value
A list containing:
-
trend
: trend component. -
season
: season component. -
irregular
: irregular component. -
f.season
: forecasted seasonal component ifh>0
. -
g
: pure seasonal model parameters.
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com.
References
Ord K., Fildes R., Kourentzes N. (2017) Principles of Business Forecasting, 2e. Wessex Press Publishing Co., p.106-111.
Examples
decomp(referrals)
Geometric mean
Description
Calculate the geometric mean.
Usage
geomean(x, na.rm = c(FALSE, TRUE), ...)
Arguments
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. |
Value
The geometirc mean of the values in x
.
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com.
Examples
geomean(c(0.5,1,1.5))
Optimal temporal aggregation level for AR(1), MA(1), ARMA(1,1)
Description
Calculate the theoretically optimal temporal aggregation level for AR(1), MA(1) and ARMA(1,1) time series.
Usage
getOptK(y, m = 12, type = c("ar", "ma", "arma"))
Arguments
y |
a time series that must be of either |
m |
maximum aggregation level. |
type |
type of data generating process. Can be:
|
Value
Identified optimal temporal aggregation level.
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com.
References
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.
Examples
getOptK(referrals)
Create lead/lags of a variable
Description
Create an array with lead/lags of an input variable.
Usage
lagmatrix(x, lag)
Arguments
x |
input variable. |
lag |
vector of leads and lags. Positive numbers are lags, negative are leads. O is the original |
Value
An array with the resulting leads and lags (columns).
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com
Examples
x <- rnorm(10)
lagmatrix(x,c(0,1,-1))
Generate sequence of lambda for LASSO regression
Description
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.
Usage
lambdaseq(
x,
y,
weight = NA,
alpha = 1,
standardise = TRUE,
lambdaRatio = 1e-04,
nLambda = 100,
addZeroLambda = FALSE
)
Arguments
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 |
Value
A list that contains:
-
lambda
: sequence of lambda values, fromlambdaMax
tolambdaMin
. -
lambdaMin
: minimal lambda value. -
lambdaMax
: maximal lambda value. -
nullMSE
: MSE of the fit using just a constant term.
Author(s)
Oliver Schaer, info@oliverschaer.ch,
Nikolaos Kourentzes, nikolaos@kourentzes.com.
References
Hastie, T., Tibshirani, R., & Wainwright, M. (2015). Statistical learning with sparsity: the lasso and generalizations. CRC press.
Examples
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/training zeros/NAs
Description
Remove leading or trailing zeros or NAs from a vector.
Usage
leadtrail(
x,
rm = c("zeros", "na"),
lead = c(TRUE, FALSE),
trail = c(TRUE, FALSE)
)
Arguments
x |
vector of values to check. |
rm |
what to remove, can be |
lead |
If |
trail |
If |
Value
Resulting vector.
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com.
Examples
x <- c(rep(0,5),rnorm(100),rep(0,5))
leadtrail(x)
Multiplicative seasonality test
Description
correlation based multiplicative seasonality test.
Usage
mseastest(
y,
m = NULL,
type = c("pearson", "spearman", "kendall"),
cma = NULL,
sn = 1,
alpha = 0.05,
outplot = c(0, 1, 2)
)
Arguments
y |
input time series. Can be |
m |
seasonal period. If |
type |
type of correlation
|
cma |
input precalculated level/trend for the analysis. Use |
sn |
number of seasonal periods of decreasing magnitude to consider for the test. |
alpha |
significance level. |
outplot |
type of output plot:
|
Value
A list with the following:
-
is.multiplicative
: ifTRUE
the test found evidence of multiplicative seasonality. -
statistic
: test statistic. -
pvalue
: p-value of the test.
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com.
Examples
mseastest(referrals)
Nonparametric multiple comparisons (Nemenyi test)
Description
Perform nonparametric multiple comparisons, across columns, using the Friedman and the post-hoc Nemenyi tests.
Usage
nemenyi(
data,
conf.level = 0.95,
sort = c(TRUE, FALSE),
plottype = c("vline", "none", "mcb", "vmcb", "line", "matrix"),
select = NULL,
labels = NULL,
...
)
Arguments
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 |
Value
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. Outputintervals
is calculate asmeans
+/-cd
. -
conf.level
: confidence level used for testing. -
k
: number of treatments (columns). -
n
: number of observations (rows).
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com,
Ivan Svetunkov, ivan@svetunkov.ru.
References
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.
Examples
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")
Plot temporal hierarchy
Description
Plots the temporal hierarchy for a given time series of seasonal periodicity.
Usage
plotSthief(y, labels = c(TRUE, FALSE), ...)
Arguments
y |
input time series (a |
labels |
if |
... |
additional arguments passed to the plotting function. |
Value
Produces a plot of the temporal hierarchy.
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com.
References
Athanasopoulos, G., Hyndman, R. J., Kourentzes, N., & Petropoulos, F. (2017). Forecasting with temporal hierarchies. European Journal of Operational Research, 262(1), 60-74.
Examples
plotSthief(AirPassengers)
NHS A&E Referrals
Description
Monthly Accident & Emergency referrals for England and Wales.
References
https://www.england.nhs.uk/statistics/statistical-work-areas/ae-waiting-times-and-activity/
Residuals control chart
Description
Create a control chart of residuals and identify outliers.
Usage
residout(resid, t = 2, outplot = c(TRUE, FALSE))
Arguments
resid |
vector of residuals. |
t |
threshold value over which standardised residuals are regarded as outliers. |
outplot |
if |
Value
A list containing:
-
location
: locations of outliers. -
outliers
: values of outliers. -
residuals
: standardised residuals.
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com.
Examples
residout(rnorm(50), outplot=TRUE)
Create seasonal dummy variables.
Description
Create binary or trigonometric seasonal dummies.
Usage
seasdummy(n, m = NULL, y = NULL, type = c("bin", "trg"), full = c(FALSE, TRUE))
Arguments
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 |
Value
An array with seasonal dummies, where rows correspond observations and columns to dummy variables.
Note
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.
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com
Examples
seasdummy(24,12)
Seasonal plots with simplistic trend/season tests
Description
Construct seasonal plots of various styles for a given time series. The series can automatically detrended as needed.
Usage
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,
...
)
Arguments
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 |
Value
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 (usingcmav
) orNULL
iftrend=FALSE
. -
trend.exist
:TRUE
/FALSE
results of trend test. -
trend.pval
: p-value of trend test (Cox-Stuart). -
decomposition
: type of decomposition used.
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com.
Examples
seasplot(referrals,outplot=1)
Theta method
Description
Estimate Theta method.
Forecast with fitted Theta method.
Produce a plot of the fitted Theta method.
Usage
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, ...)
Arguments
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 |
Details
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.
Value
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"
: IfTRUE
, 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.
Functions
-
theta.thief()
: Wrapper function to use Theta withthief
.
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com.
References
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.
Examples
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
Description
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.
Usage
trendtest(
y,
extract = c("FALSE", "TRUE"),
type = c("aicc", "cs"),
mta = c(FALSE, TRUE)
)
Arguments
y |
a time series that must be of either |
extract |
if |
type |
type of test. Can be:
|
mta |
If |
Details
All tests are performed at 5
Value
The function returns TRUE
when there is evidence of trend and FALSE
otherwise.
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com.
References
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.
Examples
trendtest(referrals,TRUE)
tsutils: Time Series Exploration, Modelling and Forecasting
Description
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.
Time series exploration
-
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.
Time series modelling
-
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.
Hierarchical time series
-
Sthief
: temporal hierarchy S matrix. -
plotSthief
: plot temporal hierarchy S matrix.
Forecasting process modelling
Quality of life
-
geomean
: geometric mean. -
lambdaseq
: generate sequence of lambda for LASSO regression. -
leadtrail
: remove leading/training zeros/NAs. -
wins
: winsorisation, including vectorised versionscolWins
androwWins
.
Time series data
-
referrals
: A&E monthly referrals.
Winsorise
Description
Winsorise either by number or percentage of observations.
Usage
wins(x, p = 0.05)
colWins(x, p = 0.05)
rowWins(x, p = 0.05)
Arguments
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). |
Value
Winsorised vector.
Functions
-
colWins()
: Vectorised version of wins by columns. -
rowWins()
: Vectorised version of wins by rows.
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com.
Examples
x <- rnorm(100,mean=0,sd=1)
xW <- wins(x)
XYZ analysis
Description
Perform XYZ analysis on a set of time series.
Usage
xyz(x, m = NULL, prc = c(0.2, 0.3, 0.5), type = c("naive", "ets", "cv"))
Arguments
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:
|
Value
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.
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com.
References
Ord K., Fildes R., Kourentzes N. (2017) Principles of Business Forecasting, 2e. Wessex Press Publishing Co., p.515-518.
See Also
Examples
x <- abs(matrix(cumsum(rnorm(5400,0,1)),36,150))
z <- xyz(x,m=12)
print(z)
plot(z)