Title: | Material Management |
---|---|
Description: | A set of functions, classes and methods for performing ABC and ABC/XYZ analyses, identifying overperforming, underperforming and constantly performing items, and plotting, analyzing as well as predicting the temporal development of items. |
Authors: | Leon Binder [cre, aut], Bernhard Bauer [aut], Michael Scholz [aut] |
Maintainer: | Leon Binder <[email protected]> |
License: | GPL-3 |
Version: | 1.1.3 |
Built: | 2024-12-06 06:54:42 UTC |
Source: | CRAN |
A set of functions, classes and methods for performing ABC and ABC/XYZ analyses, identifying overperforming, underperforming and constantly performing items, and plotting, analyzing as well as predicting the temporal development of items.
Package: | matman |
Type: | Package |
Version: | 1.1.4 |
Date: | 2021-11-15 |
License: | GPL-3 |
Depends: | R (>= 3.5.0), stats |
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
ABCXYZComparison
This S4 class represents the result of a comparison of two ABC/XYZ analysis results.
data
(data.frame) The comparison result as data.frame.
type
(character) The type of the analysis that has been performed. This is either 'abc' or 'abcxyz'.
valueDiff
(numeric) The difference between the value of an item in ABC/XYZ analysis A and the value of the same item in ABC/XYZ analysis B that is required to consider the item in the comparison.
xyzCoefficientDiff
(numeric) The difference between the xyz coefficient of an item in ABC/XYZ analysis A and the xyz coefficient of the same item in ABC/XYZ analysis B that is required to consider the item in the comparison.
unequalABC
(logical) If TRUE
only items are returned, where the ABC-Classes are different. If FALSE only
items are returned, where the ABC-Classes are equal. If NA
, no further restriction takes place based on the column ABC.
unequalXYZ
(logical) If TRUE
only items are returned, where the XYZ-Classes are different. If FALSE only
items are returned, where the XYZ-Classes are equal. If NA
, no further restriction takes place based on the column XYZ.
Objects can be created by calling the function
compare
function. This S4 class represents the result of a comparison of two
ABC/XYZ analysis results.
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
data("Amount") data1 = Amount[sample(1:nrow(Amount), 1000),] data2 = Amount[sample(1:nrow(Amount), 1000),] abcxyzData1 = computeABCXYZAnalysis(data1, value = "value", item = "item", timestamp = "date", temporalAggregation = "day", XY = 0.5, YZ = 1) abcxyzData2 = computeABCXYZAnalysis(data2, value = "value", item = "item", timestamp = "date", temporalAggregation = "day", XY = 0.5, YZ = 1) comparison = compare(abcxyzData1, abcxyzData2) comparison
data("Amount") data1 = Amount[sample(1:nrow(Amount), 1000),] data2 = Amount[sample(1:nrow(Amount), 1000),] abcxyzData1 = computeABCXYZAnalysis(data1, value = "value", item = "item", timestamp = "date", temporalAggregation = "day", XY = 0.5, YZ = 1) abcxyzData2 = computeABCXYZAnalysis(data2, value = "value", item = "item", timestamp = "date", temporalAggregation = "day", XY = 0.5, YZ = 1) comparison = compare(abcxyzData1, abcxyzData2) comparison
ABCXYZData
This S4 class represents the result of an ABC/XYZ analysis.
data
(data.frame) The result table of an ABC/XYZ analysis.
type
(character) The type of the analysis that has been performed. This is either 'abc' or 'abcxyz'.
value
(character) The name of the value column in the result table.
item
(character) Vector of the names of the item columns in the result table.
Objects can be created by calling the function
computeABCXYZ
. This S4 class represents the result of an ABC/XYZ analysis.
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
data("Amount") abcResult = computeABCXYZAnalysis(data = Amount, value = "value", item = "item", timestamp = "date") abcResult
data("Amount") abcResult = computeABCXYZAnalysis(data = Amount, value = "value", item = "item", timestamp = "date") abcResult
Aggregates a data frame based on a timestamp column to days, weeks, months, quarters, years or total.
aggregateData( data, value = NULL, item, timestamp, temporalAggregation = c("day", "week", "month", "quarter", "year", "total"), fiscal = 1, aggregationFun = sum )
aggregateData( data, value = NULL, item, timestamp, temporalAggregation = c("day", "week", "month", "quarter", "year", "total"), fiscal = 1, aggregationFun = sum )
data |
Data frame or matrix on which the ABC analysis is performed. |
value |
Name(s) of the column variable(s) that contains the values for the ABC and XYZ analysis. |
item |
Names of the columns including the item names or identifiers (e.g., product name, EAN). |
timestamp |
Name of the column including the timestamp. This column should be in POSIX or Date-format. |
temporalAggregation |
Temporal aggregation mode for the XYZ-analysis. Possible modes are 'day', 'week', 'month', 'quarter', 'year', and 'total'. Total only aggregates by item whereas the other modes aggregate by item an temporal unit. |
fiscal |
consider the start of the business year. Default is set to 1 (January) |
aggregationFun |
Function for aggregating the value column. Default is |
Returns a data frame with the aggregated data with the columns of item, timestamp and sum, which is the sum of the value column.
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
data('Amount') aggregatedData = aggregateData(data = Amount, value = "value", item = "item", timestamp = "date", temporalAggregation = "quarter")
data('Amount') aggregatedData = aggregateData(data = Amount, value = "value", item = "item", timestamp = "date", temporalAggregation = "quarter")
A dataset containing 23 items and their amounts over 3 years of data.
Amount
Amount
A data frame with 10,000 rows and 9 variables:
Date in format yyyy-mm-dd
Date in format yyyy-'W'ww
Date in format yyyy-mm
Date in format yyyy-'Q'q
Date in format yyyy
Item ID
Item group ID
Item amount
Item value
anonymized real data
Compares two S4 objects.
compare(object1, object2, ...)
compare(object1, object2, ...)
object1 |
First S4 object. |
object2 |
Second S4 object. |
... |
Further comparison parameters. |
Comparison result.
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
data("Amount") data1 = Amount[sample(1:nrow(Amount), 1000),] data2 = Amount[sample(1:nrow(Amount), 1000),] abcxyzData1 = computeABCXYZAnalysis(data1, value = "value", item = "item", timestamp = "date", temporalAggregation = "day", XY = 0.5, YZ = 1) abcxyzData2 = computeABCXYZAnalysis(data2, value = "value", item = "item", timestamp = "date", temporalAggregation = "day", XY = 0.5, YZ = 1) comparison = compare(abcxyzData1, abcxyzData2)
data("Amount") data1 = Amount[sample(1:nrow(Amount), 1000),] data2 = Amount[sample(1:nrow(Amount), 1000),] abcxyzData1 = computeABCXYZAnalysis(data1, value = "value", item = "item", timestamp = "date", temporalAggregation = "day", XY = 0.5, YZ = 1) abcxyzData2 = computeABCXYZAnalysis(data2, value = "value", item = "item", timestamp = "date", temporalAggregation = "day", XY = 0.5, YZ = 1) comparison = compare(abcxyzData1, abcxyzData2)
Compares the class assignments of two ABC- or two ABC/XYZ analyses.
## S4 method for signature 'ABCXYZData,ABCXYZData' compare( object1, object2, valueDiff = NA, xyzCoefficientDiff = NA, unequalABC = NA, unequalXYZ = NA )
## S4 method for signature 'ABCXYZData,ABCXYZData' compare( object1, object2, valueDiff = NA, xyzCoefficientDiff = NA, unequalABC = NA, unequalXYZ = NA )
object1 |
Object of class |
object2 |
Object of class |
valueDiff |
Only items with a difference of the column value larger than valueDiff between the first and second ABC-XYZ-Analysis are returned. In the comparison data.frame a new column is added for the difference in the value columns. |
xyzCoefficientDiff |
Only items with a difference of the column xyzCoefficient larger than the xyzCoefficientDiff between the first and second ABC-XYZ-Analysis are returned. In the comparison data.frame a new column is added for the difference in the xyzCoefficient columns. |
unequalABC |
If |
unequalXYZ |
If |
An ABCYXZComparison
object.
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
data("Amount") data1 = Amount[sample(1:nrow(Amount), 1000),] data2 = Amount[sample(1:nrow(Amount), 1000),] abcxyzData1 = computeABCXYZAnalysis(data1, value = "value", item = "item", timestamp = "date", temporalAggregation = "day", XY = 0.5, YZ = 1) abcxyzData2 = computeABCXYZAnalysis(data2, value = "value", item = "item", timestamp = "date", temporalAggregation = "day", XY = 0.5, YZ = 1) comparison = compare(abcxyzData1, abcxyzData2)
data("Amount") data1 = Amount[sample(1:nrow(Amount), 1000),] data2 = Amount[sample(1:nrow(Amount), 1000),] abcxyzData1 = computeABCXYZAnalysis(data1, value = "value", item = "item", timestamp = "date", temporalAggregation = "day", XY = 0.5, YZ = 1) abcxyzData2 = computeABCXYZAnalysis(data2, value = "value", item = "item", timestamp = "date", temporalAggregation = "day", XY = 0.5, YZ = 1) comparison = compare(abcxyzData1, abcxyzData2)
Divides a given data frame into 3 classes, A, B, C, according to the value of one column (e.g., revenue).
computeABCXYZAnalysis( data, value, item, timestamp, temporalAggregation = c("day", "week", "month", "quarter", "year"), AB = 80, BC = 95, XY = NA, YZ = NA, ignoreZeros = FALSE )
computeABCXYZAnalysis( data, value, item, timestamp, temporalAggregation = c("day", "week", "month", "quarter", "year"), AB = 80, BC = 95, XY = NA, YZ = NA, ignoreZeros = FALSE )
data |
Data frame or matrix on which the ABC analysis is performed. |
value |
Name of the column variable that contains the value for the ABCXYZ analysis. |
item |
Names of the columns including the item names or identifiers (e.g., product name, EAN). |
timestamp |
Name of the column including the timestamp. This column should be in POSIX or date-format. |
temporalAggregation |
Temporal aggregation for the XYZ-analysis (i.e., "day", "week", "month", "quarter", "year"). |
AB |
Threshold (in percent) between category A and B. |
BC |
Threshold (in percent) between category B and C. |
XY |
Threshold (in percent) between category X and Y. |
YZ |
Threshold (in percent) between category Y and Z. |
ignoreZeros |
Whether zero values should be ignored in XYZ-analysis. |
Returns an ABCXYZData
object. Only positive values are displayed
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
# ABC Analysis data("Amount") abcResult = computeABCXYZAnalysis(data = Amount, value = "value", item = "item", timestamp = "date") # ABC/XYZ Analysis data("Amount") abcxyzResult = computeABCXYZAnalysis(data = Amount, value = "value", item = "item", timestamp = "date", temporalAggregation = "week", XY = 0.3, YZ = 0.5)
# ABC Analysis data("Amount") abcResult = computeABCXYZAnalysis(data = Amount, value = "value", item = "item", timestamp = "date") # ABC/XYZ Analysis data("Amount") abcxyzResult = computeABCXYZAnalysis(data = Amount, value = "value", item = "item", timestamp = "date", temporalAggregation = "week", XY = 0.3, YZ = 0.5)
Selects items with a constant value for a specified time period.
computeConstants( data, value, group, timestamp, timestampFormat = c("day", "week", "month", "quater", "year"), currentTime, thresholdTime = 7, use_latest = FALSE )
computeConstants( data, value, group, timestamp, timestampFormat = c("day", "week", "month", "quater", "year"), currentTime, thresholdTime = 7, use_latest = FALSE )
data |
Dataframe containing item stock data. |
value |
Name of the column variable containing the stock values. |
group |
Name(s) of the column(s) that are used to group stock data. These columns are usually the item ID or item name to group stock data by items. |
timestamp |
Name of the column including the timestamp. This column should be in Date, POSIX , YY-mm, YYYY-'W'ww, YYYY-mm, YYYY-'Q'q or YYYY format. |
timestampFormat |
Declares in which format the timestamp comes in (i.e., "day", "week", "month", "quarter", "year") |
currentTime |
Qualifying date for the value variable. Date must exist in data and have the same format as timestamp-variable. |
thresholdTime |
Time for which the value shouldn't exceed the threshold value. Number declares the time in the format of timestampFormat. |
use_latest |
boolean value. If TRUE data will expand and dates with noexisting values will be filled up with the latest known values. |
Returns a data frame listing all constant items, the date since when the stock is constant and the value of the stock since this time.
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
computeUnderperformer
computeOverperformer
data("Stocks") constants = computeConstants(data=Stocks, value = "stock", group = "item", timestamp = "date", timestampFormat = "day", currentTime = "2019-07-27", thresholdTime = 7, use_latest = FALSE)
data("Stocks") constants = computeConstants(data=Stocks, value = "stock", group = "item", timestamp = "date", timestampFormat = "day", currentTime = "2019-07-27", thresholdTime = 7, use_latest = FALSE)
Selects items with a value higher than a given threshold for a specified time period.
computeOverperformer( data, value, group, timestamp, timestampFormat = c("day", "week", "month", "quater", "year"), currentTime, thresholdValue = 0, thresholdTime = 90, use_latest = FALSE )
computeOverperformer( data, value, group, timestamp, timestampFormat = c("day", "week", "month", "quater", "year"), currentTime, thresholdValue = 0, thresholdTime = 90, use_latest = FALSE )
data |
Dataframe containing item stock data. |
value |
Name of the column variable containing the stock values. |
group |
Name(s) of the column(s) that are used to group stock data. These columns are usually the item ID or item name to group stock data by items. |
timestamp |
Name of the column including the timestamp. This column should be in Date, POSIX , YY-mm, YYYY-'W'ww, YYYY-mm, YYYY-'Q'q or YYYY format. |
timestampFormat |
Declares in which format the timestamp comes in (i.e., "day", "week", "month", "quarter", "year") |
currentTime |
Qualifying date for the value variable. Date must exist in data and have the same format as timestamp-variable. |
thresholdValue |
Name of the colum variable containing the items' stock threshold value or the threshold value used in this analysis for all items. |
thresholdTime |
Time for which the value shouldn't exceed the threshold value. Number declares the time in the format of timestampFormat. |
use_latest |
boolean value. If TRUE data will expand and dates with noexisting values will be filled up with the latest known values. |
Returns a data frame listing all overperforming items, the date their stock was the last time under the threshold (lastunder), the duration in days since the stock is over the threshold (toolowindays), the average difference between the stock and the threshold (meandiff) and the count of switched between over- and underperformance (moves).
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
computeUnderperformer
computeConstants
data("Stocks") overperformer = computeOverperformer(data = Stocks, value = "stock", group = "item", timestamp = "date", timestampFormat = "day", currentTime = "2019-07-27", thresholdValue = "reorderlevel", thresholdTime = 0, use_latest = FALSE)
data("Stocks") overperformer = computeOverperformer(data = Stocks, value = "stock", group = "item", timestamp = "date", timestampFormat = "day", currentTime = "2019-07-27", thresholdValue = "reorderlevel", thresholdTime = 0, use_latest = FALSE)
Selects items with a value lower than a given threshold for a specified time period.
computeUnderperformer( data, value, group, timestamp, timestampFormat = c("day", "week", "month", "quater", "year"), currentTime, thresholdValue = 0, thresholdTime = 90, use_latest = FALSE )
computeUnderperformer( data, value, group, timestamp, timestampFormat = c("day", "week", "month", "quater", "year"), currentTime, thresholdValue = 0, thresholdTime = 90, use_latest = FALSE )
data |
Dataframe containing item stock data. |
value |
Name of the column variable containing the stock values. |
group |
Name(s) of the column(s) that are used to group stock data. These columns are usually the item ID or item name to group stock data by items. |
timestamp |
Name of the column including the timestamp. This column should be in Date, POSIX , YY-mm, YYYY-'W'ww, YYYY-mm, YYYY-'Q'q or YYYY format. |
timestampFormat |
Declares in which format the timestamp comes in (i.e., "day", "week", "month", "quarter", "year") |
currentTime |
Qualifying date for the value variable. Date must exist in data and have the same format as timestamp-variable. |
thresholdValue |
Name of the colum variable containing the items' stock threshold value or the threshold value used in this analysis for all items. |
thresholdTime |
Time for which the value shouldn't exceed the threshold value. Number declares the time in the format of timestampFormat |
use_latest |
boolean value. If TRUE data will expand and dates with noexisting values will be filled up with the latest known values |
Returns a data frame listing all underperforming items, the date their stock was the last time over the threshold (lastover), the duration in days since the stock is under the threshold (toolowindays), the average difference between the stock and the threshold (meandiff) and the count of switched between over- and underperformance (moves).
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
computeOverperformer
computeConstants
data("Stocks") underperformer = computeUnderperformer(data=Stocks, value = "stock", group = "item", timestamp = "date", timestampFormat = "day", currentTime = "2019-07-27", thresholdValue = "minstock", thresholdTime = 90, use_latest = FALSE)
data("Stocks") underperformer = computeUnderperformer(data=Stocks, value = "stock", group = "item", timestamp = "date", timestampFormat = "day", currentTime = "2019-07-27", thresholdValue = "minstock", thresholdTime = 90, use_latest = FALSE)
Detects items whose value (stock, demand, etc.) has changed over time in contrast to other items. This analysis is based on the Macnaughton-Smith et al. clustering algorithm.
detectTimeVariations( data, value, item, timestamp, temporalAggregation = c("day", "week", "month", "quarter", "year"), aggregationFun = sum, preProcess = NA, recentTimePeriods = 5 )
detectTimeVariations( data, value, item, timestamp, temporalAggregation = c("day", "week", "month", "quarter", "year"), aggregationFun = sum, preProcess = NA, recentTimePeriods = 5 )
data |
Data frame that will be expanded. |
value |
Name of the column variable that contains the value for the ABC and XYZ analysis. |
item |
Name of the column including the item names or identifiers (e.g., product name, EAN) |
timestamp |
Name of the column including the timestamp. This column should be in POSIX or Date-format. |
temporalAggregation |
Temporal aggregation mode (i.e., "day", "week", "month", "quarter", "year"). |
aggregationFun |
Function for aggregating the value column. Default is sum. |
preProcess |
A string vector that defines a pre-processing of the aggregated data before clustering. Available pre-processing methods are "center", "scale", "standardize", and "normalize". Default is NA (no pre-processing). |
recentTimePeriods |
Integer indicating the number of time periods that are used to define the recent item values. Default is 5. |
Returns a data frame showing to which cluster each item belongs based on all value and based on the recent values as well as whether the item has switched the cluster.
Macnaughton-Smith, P., Williams, W.T., Dale, M.B., Mockett, L.G. (1964) "Dissimilarity Analysis: a new Technique of Hierarchical Sub-division", Nature, 202, 1034–1035.
data("Amount") timeVariations = detectTimeVariations(data = Amount, value = "amount", item = "item", timestamp = "date", temporalAggregation = "week")
data("Amount") timeVariations = detectTimeVariations(data = Amount, value = "amount", item = "item", timestamp = "date", temporalAggregation = "week")
Expands a temporal data frame and fills values for missing dates.
expandData( data, expand, expandTo = c("all", "event"), valueColumns, latest_values = F, valueLevels = NA, timestamp, timestampFormat = c("day", "week", "month", "quarter", "year"), keepData = T )
expandData( data, expand, expandTo = c("all", "event"), valueColumns, latest_values = F, valueLevels = NA, timestamp, timestampFormat = c("day", "week", "month", "quarter", "year"), keepData = T )
data |
Data frame that will be expanded. |
expand |
Name of the variables that will be expanded. |
expandTo |
Defines whether values for the variables to be expanded will be filled for all dates or only those dates included in the data. |
valueColumns |
Name of the columns that are filled with specific values. |
latest_values |
If True missing values are filled with the latest known value until the next known value comes in. |
valueLevels |
Specific values that are used to fill the value columns. If latest_values = TRUE only values with no known values in the past of this values are specified with this specific values. |
timestamp |
Name of the column including the timestamp. This column should be in Date , YY-mm, YYYY-'W'ww, YYYY-mm, YYYY-'Q'q or YYYY format. |
timestampFormat |
Declares in which format the timestamp comes in (i.e., "day", "week", "month", "quarter", "year"). |
keepData |
Defines whether variables that will not be expanded should be kept. |
Returns the expanded data frame.
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
data("Amount") expandedItems = expandData(Amount, expand = c("item", "itemgroup"), expandTo = "all", valueColumns = c("amount", "value"), latest_values = TRUE, valueLevels = c(0, 0), timestamp = "date", timestampFormat = "day")
data("Amount") expandedItems = expandData(Amount, expand = c("item", "itemgroup"), expandTo = "all", valueColumns = c("amount", "value"), latest_values = TRUE, valueLevels = c(0, 0), timestamp = "date", timestampFormat = "day")
Forecast
This S4 class represents the result of forecast using function predictValue
.
data
(data.frame) Data frame including the predicted data and optionally the training data.
models
(list) List of fitted ARIMA models.
value
(character) Name of the value column.
item
(character) Name of the item column.
items
(character) IDs or Names of the items.
Objects can be created by calling the function
predictValue
. This S4 class represents the result of a forecast.
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
data("Amount") prediction = predictValue(data = Amount, value = "amount", item = "item", timestamp = "date", temporalAggregation = "week", timeUnitsAhead = 3) prediction
data("Amount") prediction = predictValue(data = Amount, value = "amount", item = "item", timestamp = "date", temporalAggregation = "week", timeUnitsAhead = 3) prediction
Launches a shiny app that demonstrates how to use the functions provides by package matman.
matmanDemo()
matmanDemo()
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
## Not run: matmanDemo()
## Not run: matmanDemo()
Plots a graph that shows what percentage of items is responsible for what amount of value.
## S4 method for signature 'ABCXYZData,ANY' plot( x, plot_engine = c("graphics", "plotly"), title = "", xlab = "", ylab = "", top5lab = NA, color = list(itemColor = "blue", top5Color = "black", aColor = "green", bColor = "orange", cColor = "red"), item = NA, ... )
## S4 method for signature 'ABCXYZData,ANY' plot( x, plot_engine = c("graphics", "plotly"), title = "", xlab = "", ylab = "", top5lab = NA, color = list(itemColor = "blue", top5Color = "black", aColor = "green", bColor = "orange", cColor = "red"), item = NA, ... )
x |
Object of class |
plot_engine |
Name of the plot engine ("graphics", "plotly") |
title |
Plot title (e.g. 'ABC-Analysis'). |
xlab |
Label of x-axis (e.g. 'Percentage of Items'). |
ylab |
Label of y-axis (e.g. 'Percentage of cumulative Value'). |
top5lab |
Title of the rank of the top 5 items (e.g. 'Items with the highest Value'). |
color |
List of plot colors (i.e., itemColor, top5Color, aColor, bColor, cColor).
Default is |
item |
Name of a single column with an identifier, that is displayed in the top-5-ranking.
Used if the |
... |
Further optional parameters for function |
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
computeABCXYZAnalysis
ABCXYZData
data("Amount") abcResult = computeABCXYZAnalysis(data = Amount, value = "value", item = "item", timestamp = "date") plot(abcResult, plot_engine = "graphics", title = "ABC Analysis", xlab = "Items", ylab = "Demand")
data("Amount") abcResult = computeABCXYZAnalysis(data = Amount, value = "value", item = "item", timestamp = "date") plot(abcResult, plot_engine = "graphics", title = "ABC Analysis", xlab = "Items", ylab = "Demand")
Plots a bar chart that shows the sum of the value column for a certain time interval.
plotValueSeries( data, item, item_id, value, timestamp, temporalAggregation = c("day", "week", "month", "quarter", "year"), expand = TRUE, withTrendLine = TRUE, windowLength = 5, trendLineType = "s" )
plotValueSeries( data, item, item_id, value, timestamp, temporalAggregation = c("day", "week", "month", "quarter", "year"), expand = TRUE, withTrendLine = TRUE, windowLength = 5, trendLineType = "s" )
data |
Data frame or matrix on which the ABC analysis is performed. |
item |
Name of the column including the item name or identifier (e.g., product name, EAN). |
item_id |
Name of the item that will be displayed. |
value |
Name of the column variable that contains the values. |
timestamp |
Name of the column including the timestamp. This column should be in POSIX or date-format. |
temporalAggregation |
Temporal aggregation for the XYZ-analysis (i.e., "day", "week", "month", "quarter", "year"). |
expand |
Indicator if the data should be expanded with time intervals that have no data. |
withTrendLine |
Indicator if a trend line should be displayed in the bar chart. |
windowLength |
Backwards window length. |
trendLineType |
If "s" the simple and if "w" the weighted moving average is calculated. |
A plotly bar chart, that shows the development of the value column.
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
data("Amount") plotValueSeries(Amount, item = "item", item_id = "45186", value = "amount", timestamp = "date", temporalAggregation = "week", withTrendLine = TRUE, windowLength = 10, trendLineType = "w")
data("Amount") plotValueSeries(Amount, item = "item", item_id = "45186", value = "amount", timestamp = "date", temporalAggregation = "week", withTrendLine = TRUE, windowLength = 10, trendLineType = "w")
Predicts the value for items based on previous values. Previous values can be aggregated to value per day, week, month, quarter or year. An ARIMA model is estimated for each item based on the function forecast:auto.arima. The best model is selected and used for prediction. Note that only models without drift term will be considered in order to ensure consistent predictions.
predictValue( data, value, item, timestamp, temporalAggregation = c("day", "week", "month", "quarter", "year"), aggregationFun = sum, timeUnitsAhead = 1, digits = 3, expand = F, keepPreviousData = F, level = 0.95, ... )
predictValue( data, value, item, timestamp, temporalAggregation = c("day", "week", "month", "quarter", "year"), aggregationFun = sum, timeUnitsAhead = 1, digits = 3, expand = F, keepPreviousData = F, level = 0.95, ... )
data |
Data frame including previous values. |
value |
Name of the column representing the item value. |
item |
Name of the column representing the item ID or the item name. |
timestamp |
Name of the column including the timestamp. This column should be in POSIX or date-format. |
temporalAggregation |
Temporal aggregation mode (i.e., "day", "week", "month", "quarter", "year"). |
aggregationFun |
Function for aggregating the value column. Default is sum. |
timeUnitsAhead |
Integer indicating the number of time units (i.e., days, weeks, months, quarters or years) the should be predicted. |
digits |
Integer indicating the number of significant digits used for the predicted values. |
expand |
Logical indicating whether the data will be expanded after they are aggregated. Default is not (FALSE). |
keepPreviousData |
Logical indicating whether the data from the given data frame will be added to the result or not. Default is not (FALSE). |
level |
Numeric value representing the confidence level for the predictions. The default is 0.95 (i.e. lower level = 0.025 and upper level = 0.975). |
... |
Further arguments for function forecast::auto.arima. |
Returns a Forecast
object.
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
# Simple Example data("Amount") prediction = predictValue(data = Amount, value = "amount", item = "item", timestamp = "date", temporalAggregation = "week", timeUnitsAhead = 3) prediction # More Sophisticated Example data("Amount") prediction = predictValue(data = Amount, value = "amount", item = "item", timestamp = "date", temporalAggregation = "week", aggregationFun = mean, timeUnitsAhead = 5, digits = 4, keepPreviousData = TRUE, level = 0.9, trace = TRUE) prediction
# Simple Example data("Amount") prediction = predictValue(data = Amount, value = "amount", item = "item", timestamp = "date", temporalAggregation = "week", timeUnitsAhead = 3) prediction # More Sophisticated Example data("Amount") prediction = predictValue(data = Amount, value = "amount", item = "item", timestamp = "date", temporalAggregation = "week", aggregationFun = mean, timeUnitsAhead = 5, digits = 4, keepPreviousData = TRUE, level = 0.9, trace = TRUE) prediction
Shows an ABCXYZComparison
object as a table consisting of the absolute and relative amount of each item,
the cumulative relative amount and the ABC-class for both ABCXYZData
objects. It furthermore shows the
ABC comparison of the two objects. If XY and YZ parameters have been specified for computing the
ABCXYZData
object, the table also includes a column for the XYZ coefficient, the XYZ-class, the
ABC/XYZ-class and the XYZ comparison.
## S4 method for signature 'ABCXYZComparison' show(object)
## S4 method for signature 'ABCXYZComparison' show(object)
object |
The |
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
data("Amount") data1 = Amount[sample(1:nrow(Amount), 1000),] data2 = Amount[sample(1:nrow(Amount), 1000),] abcxyzData1 = computeABCXYZAnalysis(data1, value = "value", item = "item", timestamp = "date", temporalAggregation = "day", XY = 0.5, YZ = 1) abcxyzData2 = computeABCXYZAnalysis(data2, value = "value", item = "item", timestamp = "date", temporalAggregation = "day", XY = 0.5, YZ = 1) comparison = compare(abcxyzData1, abcxyzData2) comparison
data("Amount") data1 = Amount[sample(1:nrow(Amount), 1000),] data2 = Amount[sample(1:nrow(Amount), 1000),] abcxyzData1 = computeABCXYZAnalysis(data1, value = "value", item = "item", timestamp = "date", temporalAggregation = "day", XY = 0.5, YZ = 1) abcxyzData2 = computeABCXYZAnalysis(data2, value = "value", item = "item", timestamp = "date", temporalAggregation = "day", XY = 0.5, YZ = 1) comparison = compare(abcxyzData1, abcxyzData2) comparison
Shows the ABCXYZData
object as a table consisting of the absolute and relative amount of each item,
the cumulative relative amount and the ABC-class. If XY and YZ parameters have been specified for
computing the ABCXYZData object, the table also includes a column for the XYZ coefficient, the XYZ-
class and the ABC/XYZ-class.
## S4 method for signature 'ABCXYZData' show(object)
## S4 method for signature 'ABCXYZData' show(object)
object |
The |
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
ABCXYZData
computeABCXYZAnalysis
data("Amount") abcResult = computeABCXYZAnalysis(data = Amount, value = "value", item = "item", timestamp = "date") abcResult
data("Amount") abcResult = computeABCXYZAnalysis(data = Amount, value = "value", item = "item", timestamp = "date") abcResult
Shows the predicted data of a Forecast object. If the Forecast object was created using keepPreviousData = TRUE, also the training data are shown
## S4 method for signature 'Forecast' show(object)
## S4 method for signature 'Forecast' show(object)
object |
The |
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
data("Amount") prediction = predictValue(data = Amount, value = "amount", item = "item", timestamp = "date", temporalAggregation = "week", timeUnitsAhead = 3) prediction
data("Amount") prediction = predictValue(data = Amount, value = "amount", item = "item", timestamp = "date", temporalAggregation = "week", timeUnitsAhead = 3) prediction
A dataset containing 10 items and their stocks over 3 years of data.
Stocks
Stocks
A data frame with 1,610 rows and 5 variables:
Date in format yyyy-mm-dd
Item ID
Item stock value
Minimum stock per item
Stock threshold for triggering item reorders
anonymized real data
Summarizes an S4 object.
summary(object, ...)
summary(object, ...)
object |
S4 object. |
... |
Optional parameters. |
Summary.
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
data("Amount") abcResult = computeABCXYZAnalysis(data = Amount, value = "value", item = "item", timestamp = "date") summary(abcResult)
data("Amount") abcResult = computeABCXYZAnalysis(data = Amount, value = "value", item = "item", timestamp = "date") summary(abcResult)
Summarizes the differences between two ABCXYZData
objects.
## S4 method for signature 'ABCXYZComparison' summary(object, withMissing = FALSE)
## S4 method for signature 'ABCXYZComparison' summary(object, withMissing = FALSE)
object |
Object of class ABCXYZComparison. |
withMissing |
Logical indicating whether missing categories will be shown. Default is |
A contingency table showing the differences.
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
data("Amount") data1 = Amount[sample(1:nrow(Amount), 1000),] data2 = Amount[sample(1:nrow(Amount), 1000),] abcxyzData1 = computeABCXYZAnalysis(data1, value = "value", item = "item", timestamp = "date", temporalAggregation = "day", XY = 0.5, YZ = 1) abcxyzData2 = computeABCXYZAnalysis(data2, value = "value", item = "item", timestamp = "date", temporalAggregation = "day", XY = 0.5, YZ = 1) comparison = compare(abcxyzData1, abcxyzData2) summary(comparison)
data("Amount") data1 = Amount[sample(1:nrow(Amount), 1000),] data2 = Amount[sample(1:nrow(Amount), 1000),] abcxyzData1 = computeABCXYZAnalysis(data1, value = "value", item = "item", timestamp = "date", temporalAggregation = "day", XY = 0.5, YZ = 1) abcxyzData2 = computeABCXYZAnalysis(data2, value = "value", item = "item", timestamp = "date", temporalAggregation = "day", XY = 0.5, YZ = 1) comparison = compare(abcxyzData1, abcxyzData2) summary(comparison)
Summarizes the items count and value sum grouped by the different ABC- or ABC/XYZ-Classes.
## S4 method for signature 'ABCXYZData' summary(object, withMissing = FALSE)
## S4 method for signature 'ABCXYZData' summary(object, withMissing = FALSE)
object |
Object of class |
withMissing |
Logical indicating whether missing categories will be shown. Default is |
A data.table
with the summarized results.
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
computeABCXYZAnalysis
ABCXYZData
# ABC Analysis data("Amount") abcResult = computeABCXYZAnalysis(data = Amount, value = "value", item = "item", timestamp = "date") summary(abcResult) # ABC/XYZ Analysis data("Amount") abcxyzResult = computeABCXYZAnalysis(data = Amount, value = "value", item = "item", timestamp = "date", temporalAggregation = "week", XY = 0.3, YZ = 0.5) summary(abcxyzResult)
# ABC Analysis data("Amount") abcResult = computeABCXYZAnalysis(data = Amount, value = "value", item = "item", timestamp = "date") summary(abcResult) # ABC/XYZ Analysis data("Amount") abcxyzResult = computeABCXYZAnalysis(data = Amount, value = "value", item = "item", timestamp = "date", temporalAggregation = "week", XY = 0.3, YZ = 0.5) summary(abcxyzResult)
Summarizes the fitted models estimated for predicting item values (e.g., demand, stock).
## S4 method for signature 'Forecast' summary(object)
## S4 method for signature 'Forecast' summary(object)
object |
Object of class Forecast |
A data frame showing a summary of fitted models.
Leon Binder [email protected]
Bernhard Bauer [email protected]
Michael Scholz [email protected]
data("Amount") prediction = predictValue(data = Amount, value = "amount", item = "item", timestamp = "date", temporalAggregation = "week", timeUnitsAhead = 3) summary(prediction)
data("Amount") prediction = predictValue(data = Amount, value = "amount", item = "item", timestamp = "date", temporalAggregation = "week", timeUnitsAhead = 3) summary(prediction)