price_indices {PriceIndices}R Documentation

A general function to compute one or more price indices

Description

This function returns a value or values of the selected price indices.

Usage

price_indices(
  data,
  start,
  end,
  formula = c(),
  window = c(),
  splice = c(),
  base = c(),
  sigma = c(),
  r = c(),
  interval = FALSE,
  names = c()
)

Arguments

data

The user's data frame with information about sold products. It must contain columns: time (as Date in format: year-month-day,e.g. '2020-12-01'), prices (as positive numeric) and prodID (as numeric, factor or character). A column quantities (as positive numeric) is also essential even if the selected index is an unweighted formula (unit values are calculated).

start

The base period (as character) limited to the year and month, e.g. "2019-12".

end

The research period (as character) limited to the year and month, e.g. "2020-04".

formula

A vector of character strings indicating price index formulas that are to be calculated. To see available options please use the link: PriceIndices.

window

A vector of integers. Each element of the vector defines the length of the time window of the corresponding multilateral index.

splice

A vector of character strings. Each element of the vector indicates the splicing method is to be used for the corresponding multilateral index. Available values of vector elements are: "movement", "window","half","mean" and their additional variants: "window_published", "half_published" and "mean_published".

base

The vector of prior periods used in the Young- or Lowe-type price indices or hybrid/geohybrid index. Each element of the vector (as character) must be limited to the year and month, e.g. "2020-01".

sigma

The vector of elasticity of substitution parameters used in the Lloyd-Moulton, AG Mean or GEKS-LM indices (as numeric).

r

The vector of non-zero parameters used in the quadratic mean of order r quantity / price index or in the GEKS-QM index (as numeric).

interval

A logical value indicating whether the function is to provide price indices comparing the research period defined by end to the base period defined by start (then interval is set to FALSE) or all fixed base indices are to be presented (the fixed base month is defined by start).

names

A vector of strings indicating names of indices which are to be used in the resulting data frame.

Value

This general function returns a value or values of the selected price indices. If the interval parameter is set to TRUE, then it returns a data frame where its first column indicates dates and the remaining columns show corresponding values of all selected price indices. The function does not take into account aggregating over outlets or product subgroups (to consider these types of aggregating, please use the final_index function).

Examples

price_indices(milk, 
         start="2018-12",end="2019-12",
         formula=c("geks","ccdi","hybrid","fisher",
         "QMp","young","geksl_fbew"),
         window=c(13,13),
         base=c("2019-03","2019-03"),
         r=c(3),interval=TRUE)
price_indices(milk, 
         start="2018-12",end="2019-12",
         formula=c("geks","ccdi","hybrid","fisher",
         "QMp","young","geksl_fbew"),
         window=c(13,13),
         base=c("2019-03","2019-03"),
         r=c(3),interval=FALSE)

[Package PriceIndices version 0.1.9 Index]