Learn R Programming

IndexNumR (version 0.1.3)

priceIndex: Computes a bilateral price index

Description

A function to compute a price index given data on products over time

Usage

priceIndex(x, pvar, qvar, pervar, indexMethod = "laspeyres", prodID,
  sample = "matched", output = "pop", chainMethod = "pop",
  sigma = 1.0001, ...)

Arguments

x

A dataframe containing price, quantity, a time period identifier and a product identifier. It must have column names.

pvar

A character string for the name of the price variable

qvar

A character string for the name of the quantity variable

pervar

A character string for the name of the time variable. This variable must contain integers starting at period 1 and increasing in increments of 1 period. There may be observations on multiple products for each time period.

indexMethod

A character string to select the index number method. Valid index number methods are dutot, carli, jevons, laspeyres, paasche, fisher, cswd, harmonic, tornqvist, satovartia, walsh, CES, geomLaspeyres and geomPaasche.

prodID

A character string for the name of the product identifier

sample

A character string specifying whether a matched sample should be used.

output

A character string specifying whether a chained (output="chained") , fixed base (output="fixedBase") or period-on-period (output="pop") price index numbers should be returned. Default is period-on-period.

chainMethod

A character string specifying the method of chain linking to use if the output option is set to "chained". Valid options are "pop" for period-on-period, and similarity chain linked options "plspread" for the Paasche-Laspeyres spread, "asymplinear" for weighted asymptotically linear, "logquadratic" for the weighted log-quadratic, and "mixScale" for the mix, scale or absolute dissimilarity measures. The default is period-on-period. Additional parameters can be passed to the mixScaleDissimilarity function using ...

sigma

The elasticity of substitution for the CES index method.

...

this is used to pass additional parameters to the mixScaleDissimilarity function.

Examples

Run this code
# NOT RUN {
# period-on-period Laspeyres index for the CES_sigma_2 dataset
priceIndex(CES_sigma_2, pvar="prices", qvar="quantities", pervar="time",
prodID = "prodID", indexMethod = "laspeyres")

# chained Fisher index
priceIndex(CES_sigma_2, pvar="prices", qvar="quantities", pervar="time",
prodID = "prodID", indexMethod = "fisher", output="chained")

# chained Tornqvist index, with linking periods chosen by the
# weighted log-quadratic dissimilarity measure
priceIndex(CES_sigma_2, pvar="prices", qvar="quantities", pervar="time",
prodID = "prodID", indexMethod = "tornqvist", output="chained",
chainMethod = "logquadratic")
# }

Run the code above in your browser using DataLab