Skip to contents

The contribution function implements the formula for calculating the contribution of a cpi component to its parent level, as set out in the ONS CPI Technical Manual.

The function must be applied to an unchained index. The unchain() function can be used to unchain a series. The formula is valid for data after 2018 when the CPI weights updated twice a year, and is set out below.

\(c = component\ c\)

\(a =\ 'all\ items'\ CPI\ index\)

\(W^c_{y} = weight\ of\ component\ c\ in\ year\ y\)

\(I^c_t = index\ for\ component\ c\ in\ month\ t\ based\ on\ January\ of\ current\ year =100\)

\(I^a_{Jan} = all\ items\ index\ for\ January\ based\ on\ previous\ month\ (December) = 100\)

\(I^a_{Dec} = all\ items\ index\ for\ December\ based\ on\ previous\ January = 100\)

$$ (\frac{W^c_{y-1}} {W^a_{y-1}}) \times (\frac{({I^c_{Dec}} - {I^c_{t-12}})}{I^a_{t-12}}) \times 100 \ \ +\ \ (\frac{W^c_y}{W^a_y}) \times (\frac{({I^c_{Jan}}-100)}{I^a_{t-12}}) \times I^a_{Dec} \ \ +\ \ (\frac{W^c_y}{W^a_y}) \times (\frac{(I^c_t - 100)}{I^a_{t-12}}) \times \frac{I^a_{Jan}}{100} \times I^a_{Dec} $$

You should apply contribution() to a wide dataframe: one that has a field containing the dates for the series, and columns containing the relevant series indices and their weights.

Usage

contribution(
  month,
  all_items_index,
  all_items_weight,
  component_index,
  component_weight
)

Arguments

month

A month number

all_items_index

All items (or category) index

all_items_weight

All items (or category) weight

component_index

Component item index

component_weight

Component item weight

Value

A contribution value

Examples

if (FALSE) { # \dontrun{
bread = contribution(month = month(date),
  all_items_index = L523,
  all_items_weight = L5CZ,
  component_index = L52I,
  component_weight = L5DH)
} # }