quantityIndex: Computes a bilateral quantity index

View source: R/bilateral.R

quantityIndexR Documentation

Computes a bilateral quantity index

Description

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

Usage

quantityIndex(
  x,
  pvar,
  qvar,
  pervar,
  indexMethod = "laspeyres",
  prodID,
  sample = "matched",
  output = "pop",
  chainMethod = "pop",
  sigma = 1.0001,
  basePeriod = 1,
  biasAdjust = TRUE,
  weights = "average",
  loweYoungBase = 1,
  imputePrices = NULL,
  ...
)

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. For elementary indexes a quantity variable is not required for the calculations and you must specify qvar = "".

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, geomPaasche, tpd, Geary-Khamis (gk), drobish, palgrave, stuvel, marshalledgeworth.

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, or "predictedshare" for the predicted share relative price dissimilarity. 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.

basePeriod

The period to be used as the base when 'fixedbase' output is chosen. Default is 1 (the first period).

biasAdjust

whether to adjust for bias in the coefficients in the bilateral TPD index. The default is TRUE.

weights

the type of weighting for the bilateral TPD index. Options are "unweighted" to use ordinary least squares, "shares" to use weighted least squares with expenditure share weights, and "average" to use weighted least squares with the average of the expenditure shares over the two periods.

loweYoungBase

the period used as the base for the lowe or young type indexes. The default is period 1. This can be a vector of values to use multiple periods. For example, if the data are monthly and start in January, specifying 1:12 will use the first twelve months as the base.

imputePrices

the type of price imputation to use for missing prices. Currently only "carry" is supported to used carry-forward/carry-backward prices. Default is NULL to not impute missing prices.

...

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

Examples

# chained Fisher quantity index for the CES_sigma_2 dataset
quantityIndex(CES_sigma_2, pvar="prices", qvar="quantities", pervar="time",
prodID = "prodID", indexMethod = "fisher", output="chained")

IndexNumR documentation built on Nov. 11, 2023, 1:07 a.m.