multilateral: Multilateral price index calculation

View source: R/user_index.R

multilateralR Documentation

Multilateral price index calculation

Description

A flexible implementation of multilateral price index calculation for scanner data. This function can be applied on any dataset where key attributes exist (depending on method). Those are in general terms a period, ID, price, and quantity. It will allow for extension of the method by the use of calculation over a window of time and splicing them together.

Usage

multilateral(
  period,
  price,
  index_method,
  check_inputs_ind = TRUE,
  verbose = FALSE,
  ...
)

## S3 method for class 'multilateral'
print(x, ...)

Arguments

period

vector of the periods corresponding to price observations.
NOTE: period must be of class Date or numeric.

price

vector of prices

index_method

The index method of choice

check_inputs_ind

logical, whether to check inputs or not

verbose

print additional information to console

...

All other possible arguments, see details

x

multilateral class object

Details

The function takes vectors for each of the inputs. It is important to note that the period argument must be of numeric or Date class. This is because the order of the dates matters.

The function also has the capability to run in parallel, using the num_cores argument. Note that for smaller datasets using non-parallel code is often faster than using parallelisation due to the overhead associated with dividing the job across multiple cores.

... represents all other possible arguments the user can provide, they include: id, quantity, weight, features, splice_method, window_length, matched, chain_method, num_cores

index_method can be one of 'TPD', 'TDH', 'GEKS-J','GEKS-F','GEKS-T', or 'GEKS-IT' you can view the configuration file found under inst/config/index_method_config for more information

splice_method can be one of 'half','window','movement','geomean', or 'geomean_short' you can view the configuration file found under inst/config/splice_method_config for more information

Value

A list object of length 3 containing;

index, a data.frame of the final spliced price index based on the method specified
index_windows, a data.frame containing each individual windows index before splicing
splice_detail, a data.frame containing the breakdown of splice information

Examples

tpd_index <- multilateral(period = turvey$month,
                          id = turvey$commodity,
                          price = turvey$price,
                          quantity = turvey$quantity,
                          splice_method = "geomean",
                          window_length = 13,
                          index_method = "TPD")

multilateral documentation built on April 20, 2022, 9:06 a.m.