shrinkflation | R Documentation |
This function detects and summarises downsized and upsized products.
shrinkflation(
data,
start,
end,
type = "shrinkflation",
min_p_change = 0,
max_p_change = Inf,
min_s_change = 0,
max_s_change = Inf,
prec = 3,
interval = FALSE
)
data |
The user's data frame with information about sold products. It must contain columns: |
start |
The base period (as character) limited to the year and month, e.g. "2024-01". |
end |
The research period (as character) limited to the year and month, e.g. "2024-02". |
type |
A parameter specifying what phenomenon is to be included in the resulting elements of the returned list (i.e. in returned |
min_p_change |
Lower limit for unit price change, i.e.: a product is considered if the percentage change in its unit price is greater than the value of this parameter. The default value is zero, possibly positive values can be considered (in percentage). |
max_p_change |
Upper limit for unit price change, i.e.: a product is considered if the percentage change in its unit price is less than the value of this parameter. The default value is Inf, possibly positive values can be considered (in percentage). |
min_s_change |
Lower limit for size change, i.e.: a product is considered if the percentage change in its size is greater than the value of this parameter. The default value is zero, possibly positive values can be considered (in percentage). |
max_s_change |
Upper limit for size change, i.e.: a product is considered if the percentage change in its size is less than the value of this parameter. The default value is Inf, possibly positive values can be considered (in percentage). |
prec |
Number of decimal places for the presented summary results. |
interval |
A parameter that specifies whether the search for downsized products should consider the entire time interval, or only the compared months specified by the |
This function detects and summarises downsized and upsized products. The function detects phenomena such as: shrinkflation
, shrinkdeflation
, sharkflation
, unshrinkdeflation
, unshrinkflation
, sharkdeflation
(see the type
parameter). It returns a list containing the following objects: df_changes
- data frame with detailed information on downsized and upsized products with the whole history of size changes, df_type
- data frame with recognized type of products, df_overview
- a table with basic summary of all detected products grouped by the type
parameter, products_detected
with prodIDs of products indicated by the 'type' parameter, df_detected
being a subset of the data frame with only detected products, df_reduced
which is the difference of the input data frame and the data frame containing the detected products,
and df_summary
which provides basic statistics for all detected downsized and upsized products (including their share in the total number of products and mean price and size changes).
Białek, J., Bobel, A., Oprych-Franków D. (2004). Immeasurability of shrinkflation in the CPI? Automatic downsizing detection using scanner data. 18th Meeting of the Ottawa Group, Ottawa.
#Data matching over time
df<-data_matching(data=data_DOWN_UP_SIZED, start="2024-01", end="2024-02",
codeIN=TRUE,codeOUT=TRUE,description=TRUE,
onlydescription=FALSE,precision=0.9,interval=FALSE)
# Extraction of information about grammage (if needed)
df<-data_unit(df,units=c("g|ml|kg|l"),multiplication="x")
# Price standardization
df<-data_norm(df, rules=list(c("ml","l",1000),c("g","kg",1000)))
# Downsized and upsized products detection
result<-shrinkflation(data=df, start="2024-01","2024-02",
prec=3, interval=FALSE, type="shrinkflation")
result$df_changes
result$df_type
result$df_overview
result$products_detected
result$df_detected
result$df_reduced
result$df_summary
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.