compare_distances: Calculating distances between price indices

compare_distancesR Documentation

Calculating distances between price indices

Description

The function calculates distances between price indices

Usage

compare_distances(
  data = data.frame(),
  measure = "MAD",
  pp = TRUE,
  first = TRUE,
  prec = 3
)

Arguments

data

A data frame containg values of indices which are to be compared

measure

A parameter specifying what measure should be used to compare the indexes. Possible parameter values are: "MAD" (Mean Absolute Distance) or "RMSD" (Root Mean Square Distance).

pp

Logical parameter indicating whether the results are to be presented in percentage points (then pp = TRUE).

first

A logical parameter that determines whether the first row of the data frame is to be taken into account when calculating the distance between the indices (then first = TRUE). Usually, the first row concerns the index values for the base period - all indexes are then set to one.

prec

Parameter that determines how many decimal places are to be used in the presentation of results.

Value

The function calculates average distances between price indices and it returns a data frame with these values for each pair of price indices.

Examples

#Creating a data frame with unweighted bilateral index values
df<-price_indices(milk, 
formula=c("jevons","dutot","carli"), 
start="2018-12", end="2019-12",interval=TRUE)
#Calculating average distances between indices (in p.p)
compare_distances(df)

PriceIndices documentation built on July 9, 2023, 6:20 p.m.