Learn R Programming

⚠️There's a newer version (0.6.0) of this package.Take me there.

IndexNumR

An R package for computation of index numbers

IndexNumR provides a set of functions for computing various bilateral and multilateral indices. It is designed to compute price or quantity indices over time. Bilateral indices include Laspeyres, Paasche, Fisher, Tornqvist, Sato-Vartia, Walsh, CES, geometric Laspeyres, geometric Paasche, time-product-dummy and Geary-Khamis as well as elementary indices Dutot, Carli, Harmonic mean, CSWD and Jevons. All of these bilateral indices can be computed as period-on-period, fixed-base or chained.

Multilateral indices can be computed in the time series context using the GEKS, Weighted Time Product Dummy or Geary-Khamis indexes, and updating is provided via the window, movement, half, mean, fbew or fbmw splicing methods. The GEKS method is computed using either the Fisher, Tornqvist, Walsh, Jevons or TPD index number methods.

The package also provides functions to compute measures of dissimilarity between time periods, which can be used to choose the linking period for chained indices.

A sample dataset is included called CES_sigma_2, which is a dataset containing prices and quantities on four products over twelve periods, but additional datasets assuming different values of the elasticity of substitution can be computed using the function CESData.

There is also a function dominicksData that can be used to download the Dominicks Finer Foods scanner data from the Chicago Booth School of Business.

Installation

You can install the released version of IndexNumR from CRAN with:

install.packages("IndexNumR")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("grahamjwhite/IndexNumR")

Example

To estimate a simple chained Laspeyres price index using the CES_sigma_2 dataset,

library(IndexNumR)

priceIndex(CES_sigma_2, 
           pvar = "prices", 
           qvar = "quantities", 
           pervar = "time", 
           prodID = "prodID", 
           indexMethod = "laspeyres", 
           output = "chained")
#>            [,1]
#>  [1,] 1.0000000
#>  [2,] 0.9673077
#>  [3,] 1.2905504
#>  [4,] 1.3382002
#>  [5,] 1.2482444
#>  [6,] 1.7346552
#>  [7,] 1.6530619
#>  [8,] 1.4524186
#>  [9,] 1.8386215
#> [10,] 1.7126802
#> [11,] 2.1810170
#> [12,] 2.2000474

A GEKS index with mean splicing and an 11 period window is estimated as follows,

GEKSIndex(CES_sigma_2, 
          pvar = "prices", 
          qvar = "quantities", 
          pervar = "time", 
          prodID = "prodID", 
          indexMethod = "tornqvist", 
          window = 11, 
          splice = "mean")
#>            [,1]
#>  [1,] 1.0000000
#>  [2,] 0.8927314
#>  [3,] 1.0776386
#>  [4,] 1.1127724
#>  [5,] 0.9310834
#>  [6,] 1.1785361
#>  [7,] 1.1219447
#>  [8,] 0.9380228
#>  [9,] 1.0951667
#> [10,] 0.9501914
#> [11,] 1.1277725
#> [12,] 1.1330748

More examples are contained in the package vignette.

vignette("indexnumr", package = "IndexNumR")

Copy Link

Version

Install

install.packages('IndexNumR')

Monthly Downloads

542

Version

0.5.0

License

GPL-2

Issues

Pull Requests

Stars

Forks

Maintainer

Graham White

Last Published

February 7th, 2022

Functions in IndexNumR (0.5.0)

elasticity

Computes the elasticity of substitution
evaluateMatched

Evaluate product overlap between periods
monthIndex

Generate an index of months
valueDecomposition

valueDecomposition
mixScaleDissimilarity

Computes mix, scale and absolute dissimilarity measures
values

Compute values (price x quantity)
quantityIndex

Computes a bilateral quantity index
quantityIndicator

Compute a quantity indicator
maximumSimilarityLinks

Finds periods to link using minimum dissimilarity.
imputeQuantities

Impute quantities when only prices are available
yearIndex

Generate an index of years
WTPDIndex

Compute a weighted time-product-dummy multilateral index
weekIndex

Generate an index of weeks
dominicksData

Get data from the Dominicks dataset
CESData

Generate data assuming CES preferences
shares

Compute expenditure shares for each product and time period
groupIndexes

Calculate price indexes for product groups
CES_sigma_2

Dataset of prices and quantities on four products
unitValues

Aggregates prices to unit values and quantities to sums
imputeCarryPrices

Fill all missing prices with carry forward/backward prices
IndexNumR

IndexNumR: A package for computing index numbers
GKIndex

Compute the Geary-Khamis index
predictedShares

Predicted shares for predicted share relative price dissimilarity
priceIndex

Computes a bilateral price index
yearOverYearIndexes

Estimate year-over-year indexes
relativeDissimilarity

Computes measures of relative dissimilarity between all periods
quarterIndex

Generate an index of quarters
DominicksWeeks

Date information for the Dominicks data
GEKSIndex

Compute a GEKS multilateral index
priceIndicator

Calculate a price indicator
productChanges

Product ID's for appearing/disappearing products