priceIndex: Computes a bilateral price index

Description Usage Arguments Examples

View source: R/bilateral.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
priceIndex(
  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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# 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")

Example output

           [,1]
 [1,] 1.0000000
 [2,] 0.9673077
 [3,] 1.3341674
 [4,] 1.0369221
 [5,] 0.9327785
 [6,] 1.3896759
 [7,] 0.9529628
 [8,] 0.8786232
 [9,] 1.2659033
[10,] 0.9315023
[11,] 1.2734526
[12,] 1.0087254
           [,1]
 [1,] 1.0000000
 [2,] 0.8801048
 [3,] 1.0769571
 [4,] 1.1124543
 [5,] 0.9155969
 [6,] 1.1675831
 [7,] 1.1114148
 [8,] 0.9206708
 [9,] 1.0874224
[10,] 0.9387213
[11,] 1.1185875
[12,] 1.1242851
           [,1]
 [1,] 1.0000000
 [2,] 0.8925715
 [3,] 1.0791614
 [4,] 1.1148148
 [5,] 0.9329592
 [6,] 1.1813912
 [7,] 1.1245305
 [8,] 0.9382853
 [9,] 1.0978595
[10,] 0.9520496
[11,] 1.1308955
[12,] 1.1366808

IndexNumR documentation built on Feb. 7, 2022, 5:09 p.m.