pricelevels {pricelevels}R Documentation

Spatial price indices

Description

Calculation of multiple spatial price indices at once.

Usage

# list all available price indices:
list.indices()

# compute all price indices:
pricelevels(p, r, n, q=NULL, w=NULL, base=NULL, settings=list())

Arguments

p

A numeric vector of positive prices.

r, n

A character vector or factor of regional entities r and products n, respectively.

q, w

A numeric vector of non-negative quantities q or expenditure share weights w (see Section 'Details'). Either q or w must be provided for weighted indices. If both q and w are provided, q will be used.

base

A character specifying the base region to which all price levels are expressed. If NULL, base region is set internally.

settings

A list of control settings to be used. The following settings are supported:

  • chatty : A logical specifying if warnings and info messages should be printed or not. The default is getOption("pricelevels.chatty").

  • connect : A logical specifying if the data should be checked for connectedness or not. The default is getOption("pricelevels.connect"). If the data are not connected, price levels are computed within the biggest block of connected regions or the block of regions to which the base region belongs. See also connect().

  • plot : A logical specifying if the calculated price levels should be plotted or not. If TRUE, the price ratios of each region are displayed as boxplots and the price levels are added as colored points. The default is getOption("pricelevels.plot").

  • type : A character specifying the index method(s) used to aggregate individual prices into price indices. See list.indices() for allowed values. The default is NULL in which case all possible price indices are computed.

  • ... : Further settings allowed for the index methods. Note that settings$solve is always set to iterative.

Details

Before calculations start, missing values are removed from the data. Duplicated observations for r and n are aggregated, that is, duplicated prices p and weights w are averaged and duplicated quantities q added up. If there is more than one region in the data, products with prices in only one region r are removed.

The weights w must represent expenditure shares defined as w_i^r = p_i^r q_i^r / \sum_{j=1}^{N} p_j^r q_j^r. They are internally (re-)normalized such that they add up to 1 for each region r.

Value

A matrix of price levels where the rows contain the index methods and the columns the regions.

Author(s)

Sebastian Weinand

Examples

# sample complete price data:
set.seed(123)
dt1 <- rdata(R=3, B=1, N=5)

# compute specific unweighted price indices:
dt1[, pricelevels(p=price, r=region, n=product, base="1",
                  settings=list(type=c("jevons","cswd","bmw")))]

# compute all unweighted price indices:
dt1[, pricelevels(p=price, r=region, n=product, base="1")]

# compute the price indices using all methods:
dt1[, pricelevels(p=price, r=region, n=product, q=quantity, base="1")]

# add price data:
dt2 <- rdata(R=4, B=1, N=4)
dt2[, "region":=factor(region, labels=4:7)]
dt2[, "product":=factor(product, labels=6:9)]
dt <- rbind(dt1, dt2)
dt[, is.connected(r=region, n=product)] # non-connected now

# compute all unweighted indices:
dt[, pricelevels(p=price, r=region, n=product, base="1")]

# change base region:
dt[, pricelevels(p=price, r=region, n=product, base="4")]

[Package pricelevels version 1.4.0 Index]