Package 'chainlink'

Title: Chain-Linked Price and Volume Measures
Description: Tools to derive price and volume measures of national accounts following chapter 8 of the International Monetary Fund (2018) "Quarterly National Accounts Manual (2017 Edition)" <doi:10.5089/9781475589870.069>: Laspeyres-type, Paasche-type and Fisher-type volume indices, chain-linking of quarterly or monthly volume indices with the annual overlap and the one-quarter overlap techniques, exact contributions to percent change of the chain-linked volume measures, and non-additivity of the chain-linked series. The benchmarking of the quarterly series on annual data can be done with the 'tempdisagg' package.
Authors: Alain Quartier-la-Tente [aut, cre] (ORCID: <https://orcid.org/0000-0001-7890-3857>)
Maintainer: Alain Quartier-la-Tente <[email protected]>
License: EUPL-1.2
Version: 0.1.0.9000
Built: 2026-11-24 21:41:55 UTC
Source: https://github.com/AQLT/chainlink

Help Index


Contributions to percent change of chain-linked volume measures

Description

Exact contributions of the components to the percent change of a total chain-linked with the annual overlap ("ao") or the one-quarter overlap ("oqo") technique (IMF QNA Manual, chapter 8, example 8.9).

Usage

chain_contrib(
  vo,
  cp,
  vo_total = NULL,
  cp_total = NULL,
  method = c("ao", "oqo"),
  type = c("period", "yoy", "annual"),
  base_year = NULL,
  extra = NULL,
  pi = NULL,
  overlap_prices = c("year_prices", "current_prices")
)

Arguments

vo

Chain volume measures (in monetary terms) of the components (ts or mts), as returned by chain_link() or chain_laspeyres() with output = "measure". If vo_total is NULL, the last column of vo is the total (as returned by chain_laspeyres()).

cp

Current prices of the components (same number of columns as vo, without the total). It must cover the base year.

vo_total

Chain volume measure of the total (ts). It cannot be deduced from vo because chain measures are not additive. By default (NULL), the last column of vo is used (and the last column of cp is the total of the current prices, if cp has one more column than the components).

cp_total

Current prices of the total. By default, the sum of cp (only valid if cp contains all the components).

method

Chain-linking technique used to compute vo and vo_total: "ao" (annual overlap) or "oqo" (one-quarter overlap, built as in the manual: see chain_laspeyres()).

type

Growth to decompose: "period" (default) for the growth over the previous period (quarter or month), "yoy" for the growth over the same period of the previous year, "annual" for the growth of the annual sums. For method = "oqo", the contributions to annual growth are only defined from the second year (the annual sum of the base year is not defined).

base_year

Reference year of the chain measures. By default, the year before the start of vo (or the first year of cp, if later).

extra

Additional columns: "total" adds the growth of the total, and "residual" the difference between this growth and the sum of the contributions (non-additivity). Default: none.

pi

Price indices of the components over the previous year (previous year average = 100), needed for method = "oqo" to value the overlap period at the average prices of the year (see cp_pi2cy()). If NULL, cp must already be valued at the average prices of the year (cp_pi2cy()).

overlap_prices

Only for method = "oqo": prices used to value the overlap period when vo was computed, "year_prices" (average prices of the year, default) or "current_prices" (own current prices): see chain_laspeyres(). With "current_prices", cp is used as it is and pi is not needed.

Details

Let xtx_t be the chain volume measure of a component and ztz_t the one of the total. Within year yy, the total is exactly zt=∑iρi,y−1xi,tz_t = \sum_i \rho_{i,y-1} x_{i,t}, where ρi,y−1\rho_{i,y-1} is the relative price (price of the component / price of the total) of the previous year:

  • method = "ao": ρy=(cpyx/xy)/(cpyz/zy)\rho_y = (cp^x_y / x_y) / (cp^z_y / z_y) with annual sums;

  • method = "oqo": the same ratio computed on the overlap period (the last period of the year), with the values at the average prices of the year (cp_pi2cy()). In the reference year, the ratio is 1 (the first year is linked with the annual overlap technique).

The contribution to the growth between a period ss and a period tt (previous period, same period of the previous year, or previous year) is

100[(xt−xs)ρy(t)−1zs+(xszs−ay(t)−1)(ρy(t)−1−ρy(s)−1)]100 \left[ \frac{(x_t - x_s)\rho_{y(t)-1}}{z_s} + \left(\frac{x_s}{z_s} - a_{y(t)-1}\right)(\rho_{y(t)-1} - \rho_{y(s)-1})\right]

where ay=xy/zya_y = x_y / z_y (annual overlap) or the share of the overlap period (one-quarter overlap). The second term is zero when ss and tt are in the same year, and for the annual overlap technique it is also zero for annual growth. For the growth over the previous period with the annual overlap technique, it gives the formulas of the example 8.9. Contributions add up to the growth of the total (up to the inconsistencies of the data: see extra = "residual").

For the annual overlap technique, type = "period" and type = "annual" are the equations (29) and (30) of the manual (paragraphs 8.86 and 8.87, example 8.9) and type = "yoy" is the equation (31) (paragraph 8.88).

For the one-quarter overlap technique, the manual (footnote 35) applies the same formulas with the annual deflators, but the contributions are then not exactly additive. With method = "oqo", the deflators of the overlap period are used, so that contributions add up exactly. The formulas of the manual can be obtained with method = "ao" applied to the one-quarter overlap measures.

As recommended by the manual (paragraph 8.90), the contribution of a variable that can be negative, zero or positive (such as changes in inventories) should be calculated residually: the difference between the contribution of the aggregate that includes it and the contributions of the other components.

Series can be monthly: the "overlap period" is then the last month of the year.

Value

A ts (or mts) of contributions, in percentage points, with the same columns as vo (followed by Total and/or Residual). It has the span of vo (extended to complete years), with NA when a contribution cannot be computed (e.g. the first periods).

References

International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.

See Also

chain_laspeyres(), chain_link(), chain_discrepancy(), fisher_contrib()

Examples

# Chain volume measures of the components and of the total (last column)
x <- chain_laspeyres(imf_cp, imf_pi, method = "ao", base_year = 2010,
					 output = "measure")
# Contributions to the growth over the previous quarter
chain_contrib(x, imf_cp, method = "ao", extra = c("total", "residual"))
# Contributions to the growth over the same quarter of the previous year
chain_contrib(x, imf_cp, method = "ao", type = "yoy")
# Contributions to the growth of the annual sums
chain_contrib(x, imf_cp, method = "ao", type = "annual")

# One-quarter overlap
x_oqo <- chain_laspeyres(imf_cp, imf_pi, method = "oqo", base_year = 2010,
						 output = "measure")
chain_contrib(x_oqo, imf_cp, method = "oqo", type = "yoy", pi = imf_pi)
# One-quarter overlap, overlap quarter at its own current prices
x_cp <- chain_laspeyres(
  imf_cp, imf_pi, method = "oqo", base_year = 2010,
	 overlap_prices = "current_prices", output = "measure"
)
chain_contrib(x_cp, imf_cp, method = "oqo", type = "yoy",
			  overlap_prices = "current_prices")

Non-additivity of chain-linked volume measures

Description

Chain-linked volume measures are not additive: the chain volume measure of the total differs from the sum of the chain volume measures of its components (except in the base year and, with the annual overlap technique, in the year after the base year). This function returns the difference, with the sign of the column "Discrepancies" of the examples 8.6 and 8.7 of the manual: the sum of the components minus the total,

Dt=∑ixi,t−zt,D_t = \sum_i x_{i,t} - z_t,

with xi,tx_{i,t} the chain volume measures of the components and ztz_t the one of the total (100 Dt/zt100\, D_t / z_t with relative = TRUE).

Usage

chain_discrepancy(vo, vo_total = NULL, relative = FALSE)

Arguments

vo

Chain volume measures (in monetary terms) of the components (ts or mts). If vo_total is NULL, the last column is the total (as returned by chain_laspeyres() with output = "measure").

vo_total

Chain volume measure of the total (ts).

relative

Boolean: if TRUE, the discrepancy is expressed in percent of the chain volume measure of the total.

Value

A ts: sum of the chain volume measures of the components minus the chain volume measure of the total.

References

International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.

See Also

chain_contrib()

Examples

x <- chain_laspeyres(imf_cp, imf_pi, method = "ao", base_year = 2010,
					 output = "measure")
chain_discrepancy(x)
chain_discrepancy(x, relative = TRUE)

Chain-linked Laspeyres-type volume series of a total and its components

Description

Chain-linked volume indices (or measures) of the components and of their total in one step. For each component, the volume indices are derived from the current prices and the price indices, the volume index of the total is a Laspeyres-type index, and all of them are chain-linked (chain_link()) with the annual overlap or the one-quarter overlap technique.

Usage

chain_laspeyres(
  cp,
  pi,
  method = c("ao", "oqo"),
  base_year = NULL,
  output = c("index", "measure", "both"),
  overlap_prices = c("year_prices", "current_prices")
)

Arguments

cp

Current prices of the components (ts or mts), without the total. It must cover the base year.

pi

Price indices of the components over the previous year (previous year average = 100), with the same structure as cp.

method

Chain-linking technique: "ao" for annual overlap, "oqo" for one-quarter overlap (for monthly series, the overlap period is the last month of the year).

base_year

Reference year (index = 100). By default, the year before the start of vo (or the first year of cp, if later).

output

Chain index (the default), chain volume measure (in monetary terms, i.e. the index times the base-year current prices) or both.

overlap_prices

Only for method = "oqo": prices used to value the overlap period, "year_prices" (average prices of the year, default) or "current_prices" (own current prices). See details.

Details

With the annual overlap technique (method = "ao"), the volume indices are those of cp_pi2vol() and laspeyres() (previous year average = 100).

With the one-quarter overlap technique (method = "oqo"), the volume at the prices of the previous year of each period is divided by the value of the last period (quarter or month) of the previous year:

vt=100×100 cpt/pitcyy(t)−1,fv_t = 100 \times \frac{100\, cp_t / pi_t}{cy_{y(t)-1, f}}

where cyy,fcy_{y,f} is the value of the last period ff of year yy. This overlap period can be valued in two ways (overlap_prices):

  • "year_prices" (default), as printed in the manual (paragraph 8.72 and example 8.7): at the average prices of the year (see cp_pi2cy());

  • "current_prices", as in the spreadsheet of the manual: at its own current prices. The volume indices are then those of cp_pi2vol() with reference_freq = f and reference_cycle = f (f = 4 or 12), the "q4 previous year = 100" volume measures.

As there are no price indices in the reference year, the first year is linked with the annual overlap technique (footnote 32 of the manual).

The result with output = "measure" can be used directly in chain_contrib() and chain_discrepancy().

Value

A ts (mts): the columns of cp and a column Total. With output = "both", the indices then the measures of each variable (see chain_link()).

References

International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.

See Also

chain_contrib(), chain_discrepancy(), cp_pi2cy()

Examples

# Annual overlap
chain_laspeyres(imf_cp, imf_pi, method = "ao", base_year = 2010)
chain_laspeyres(imf_cp, imf_pi, method = "ao", base_year = 2010,
				output = "measure")
# One-quarter overlap (example 8.7 of the manual)
chain_laspeyres(imf_cp, imf_pi, method = "oqo", base_year = 2010,
				output = "measure")
# Overlap quarter valued at its own current prices
chain_laspeyres(imf_cp, imf_pi, method = "oqo", base_year = 2010,
				overlap_prices = "current_prices", output = "measure")

Pseudo chain volume series of a variable that changes sign

Description

Growth rates and chain volume measures cannot be calculated for variables that can take positive, negative and zero values, such as changes in inventories or the external trade balance (IMF QNA Manual, paragraph 8.56). The solution of the 2008 SNA (paragraphs 8.57 and 8.58) is to write the variable as the difference of two series that only take positive values, to chain-link each of them separately, and to take the difference of the chain volume measures. For instance, changes in inventories are closing inventories minus opening inventories, and the trade balance is exports minus imports.

Usage

chain_pseudo(
  cp_pos,
  pi_pos,
  cp_neg,
  pi_neg,
  method = c("ao", "oqo"),
  base_year = NULL
)

Arguments

cp_pos

Current prices of the series that takes positive values (ts; an mts is the aggregate of its columns): closing inventories, exports, etc.

pi_pos

Price indices of cp_pos over the previous year (previous year average = 100), with the same structure.

cp_neg, pi_neg

The same for the series that is subtracted (opening inventories, imports, etc.).

method

Chain-linking technique: "ao" for annual overlap, "oqo" for one-quarter overlap (for monthly series, the overlap period is the last month of the year).

base_year

Reference year (index = 100). By default, the year before the start of vo (or the first year of cp, if later).

Details

With xt+x^{+}_t and xt−x^{-}_t the chain volume measures of the two series (chain_laspeyres()), the pseudo chain volume series is xt+−xt−x^{+}_t - x^{-}_t.

The result is a pseudo chain volume series: it is the difference of two chained components, which are not additive by construction. It is expressed in monetary terms (its growth rates are meaningless). The measure of each series is that of chain_laspeyres().

If the two series are already chain-linked (in monetary terms, with the same reference year), their simple difference is the pseudo chain volume series.

Value

A ts: the chain volume measure (in monetary terms) of cp_pos minus the one of cp_neg.

References

International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.

See Also

chain_laspeyres(), chain_contrib()

Examples

# Illustration: the two products of the example 8.2 stand in for closing and
# opening inventories
chain_pseudo(imf_cp[, "A"], imf_pi[, "A"],
			 imf_cp[, "B"], imf_pi[, "B"], base_year = 2010)

Change the reference year of chain-linked series

Description

Rescale a chain index so that the average of the new reference year is 100, or a chain volume measure so that the annual sum of the new reference year is its annual current prices. With bb the new reference year,

It′=100 ItIˉb,xt′=xt cpbxb,I'_t = 100\, \frac{I_t}{\bar{I}_b}, \qquad x'_t = x_t\, \frac{cp_b}{x_b},

where Iˉb\bar{I}_b is the average of the index over the periods of year bb, and cpbcp_b and xbx_b the annual sums of the current prices and of the measure.

Usage

chain_rebase(x, base_year, cp = NULL)

Arguments

x

Chain index (if cp is NULL) or chain volume measure (in monetary terms) (ts or mts).

base_year

New reference year.

cp

Current prices, same structure as x. If provided, x is a chain volume measure.

Details

The series must cover all the periods of the new reference year. The contributions computed by chain_contrib() must be computed from series whose reference year is the one used to build them (the year before the start of the series, by default).

Value

A ts (or mts) with the same structure as x.

References

International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.

Examples

x <- chain_laspeyres(imf_cp, imf_pi, base_year = 2010)
chain_rebase(x, base_year = 2012)
x_measure <- chain_laspeyres(imf_cp, imf_pi, base_year = 2010,
							 output = "measure")
cp_all <- ts(cbind(as.matrix(imf_cp), Total = rowSums(imf_cp)),
			 start = start(imf_cp), frequency = frequency(imf_cp))
chain_rebase(x_measure, base_year = 2012, cp = cp_all)

Un-chain and aggregate chain-linked volume measures

Description

Indirect seasonal adjustment of chain-linked Laspeyres-type series (ESS Guidelines on Seasonal Adjustment, item 5.6): the seasonally adjusted components are un-chained, aggregated, and the aggregate is chain-linked again. chain_unchain() un-chains chain volume measures and chain_aggregate() derives the chain volume measure of the aggregate of components, whatever they are (seasonally adjusted components, for instance).

Usage

chain_unchain(
  x,
  cp,
  method = c("ao", "oqo"),
  base_year = NULL,
  pi = NULL,
  overlap_prices = c("year_prices", "current_prices")
)

chain_aggregate(
  x,
  cp,
  method = c("ao", "oqo"),
  base_year = NULL,
  output = c("index", "measure", "both"),
  pi = NULL,
  cp_total = NULL,
  overlap_prices = c("year_prices", "current_prices")
)

Arguments

x

Chain volume measures (in monetary terms) of the components (ts or mts), as returned by chain_link() or chain_laspeyres() with output = "measure", or their seasonally adjusted version.

cp

Current prices of the components (same number of variables as x). It must cover the reference year.

method

Chain-linking technique of x: "ao" or "oqo".

base_year

Reference year of the chain measures. By default, the year before the start of x (or the first year of cp, if later).

pi

Price indices of the components over the previous year (previous year average = 100), needed for method = "oqo" with overlap_prices = "year_prices".

overlap_prices

Only for method = "oqo": prices used to value the overlap period, "year_prices" (default) or "current_prices"; it must be the one used to compute x (see chain_laspeyres()).

output

(chain_aggregate() only) Chain index (the default), chain volume measure or both (see chain_link()).

cp_total

(chain_aggregate() only) Current prices of the aggregate. By default, the sum of cp.

Details

To derive the seasonally adjusted aggregate of seasonally adjusted chain-linked components:

  1. seasonally adjust the chain volume measures of the components (outside the package);

  2. un-chain the seasonally adjusted components: chain_unchain() returns the volume at the prices of the previous year, which is additive within each year (the sum of the components is the volume of the aggregate at the prices of the previous year);

  3. aggregate them and chain-link the aggregate (again with the same technique);

  4. re-reference it to the reference year.

With xtx_t the chain volume measure of a component, bb the reference year, ff the frequency and Λy\Lambda_y the chain level of year yy (see chain_link()), the volume at the prices of the previous year is

xtpy=xtcpb/f×oy(t)−1Λy(t)−1,x^{py}_t = \frac{x_t}{cp_b / f} \times \frac{o_{y(t)-1}}{\Lambda_{y(t)-1}},

where oyo_y is the value of the reference of year yy: the annual current prices divided by ff (annual overlap) or the value of the overlap period (one-quarter overlap). The volume index of the aggregate is then 100∑ixi,tpy/∑ioi,y(t)−1100 \sum_i x^{py}_{i,t} / \sum_i o_{i,y(t)-1}, chain-linked with chain_link().

chain_aggregate() does the steps 2 to 4. The reference year of the result is base_year and its annual current prices are those of cp, so that the seasonally adjusted aggregate is normalised to the unadjusted data of the reference year. The annual links are those of the series that are chained or un-chained: chain_unchain() is the exact inverse of chain_link() with output = "measure", and chain_aggregate() applied to the unadjusted chain volume measures of the components gives the chain volume measure of their total (chain_laspeyres()).

The annual totals of the seasonally adjusted data are not forced to be equal to the annual totals of the unadjusted data (an option of the guidelines when users require it and the unadjusted data are additive). This approach only concerns Laspeyres-type series: for other chain-linked indices, only the direct approach is feasible.

With the one-quarter overlap technique, the overlap period is valued at the average prices of the year (see cp_pi2cy()), hence the price indices pi, or at its own current prices (overlap_prices = "current_prices", pi is then not needed). The un-chaining of the first year after the reference year (or of the first year of x if the reference year is not before it) needs the level of the previous year: if the reference year is inside the series, the first year is NA.

Value

chain_unchain(): a ts (or mts) with the structure of x: the volume of each period at the (average) prices of the previous year, in monetary terms. chain_aggregate(): a ts (see chain_link() for output = "both").

References

International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.

Eurostat (2015), ESS Guidelines on Seasonal Adjustment (2015 Edition), Luxembourg, Publications Office of the European Union. doi:10.2785/317290.

See Also

chain_link(), chain_laspeyres()

Examples

x <- chain_laspeyres(imf_cp, imf_pi, base_year = 2010, output = "measure")
# Volumes at the prices of the previous year (additive within each year)
chain_unchain(x[, c("A", "B")], imf_cp, base_year = 2010)
# Aggregate of the components: the chain volume measure of the total
chain_aggregate(x[, c("A", "B")], imf_cp, base_year = 2010, output = "measure")

Values at the average prices of the year

Description

Quarterly (or monthly) values of each period valued at the weighted average prices of its own year (the column "Current Year's Prices" of the example 8.7 of the IMF QNA Manual). They are used by the one-quarter overlap technique: the overlap period is valued at the average prices of the year, and not at its own current prices.

Usage

cp_pi2cy(cp, pi)

Arguments

cp

Current prices (ts or mts).

pi

Price indices over the previous year (previous year average = 100), with the same structure as cp.

Details

The value is the volume measure at the prices of the previous year, multiplied by the annual price index of the year yy (the annual current prices divided by the annual sum of the volume measures at the prices of the previous year, see pi_annual()):

cyt=100 cptpit×piy100,piy=100×∑q∈ycpq∑q∈y100 cpq/piq,cy_t = \frac{100\, cp_t}{pi_t} \times \frac{pi_y}{100}, \qquad pi_y = 100 \times \frac{\sum_{q \in y} cp_q}{\sum_{q \in y} 100\, cp_q / pi_q},

so that the annual sum of cytcy_t is the annual current price value.

Value

A ts (or mts) with the structure of cp (extended to complete years). It is NA for the years without price indices (e.g. the reference year).

References

International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.

See Also

chain_laspeyres(), chain_contrib(), pi_annual()

Examples

cp_pi2cy(imf_cp, imf_pi)

Elementary volume indices

Description

Derive the elementary volume indices from current prices and price indices: elementary volume measures (cp / pi * 100) divided by the current prices of the reference period (the previous year, the previous period or a given period of the previous year).

Usage

cp_pi2vol(cp, pi, reference_freq = 1, reference_cycle = NULL)

Arguments

cp

Current prices (ts or mts).

pi

Price indices (previous reference period = 100), same structure as cp.

reference_freq

Frequency of the reference period: 1 (default) for the previous year, or the frequency of the data (4 or 12) for the previous period (quarter or month). It must divide the frequency of cp.

reference_cycle

Integer to use a given period of the previous year as reference (the last period of the year, 4 for quarterly data or 12 for monthly data) instead of the average of the year, as needed for the one-quarter overlap technique. It is used with reference_freq equal to the frequency of cp. The reference period is valued at its own current prices: the one-quarter overlap technique of the manual values it at the average prices of the year, see chain_laspeyres() and cp_pi2cy().

Details

With cptcp_t the current prices and pitpi_t the price index of period tt, the volume index is

vt=100×100 cpt/pitcp‾r(t)v_t = 100 \times \frac{100\, cp_t / pi_t}{\overline{cp}_{r(t)}}

where cp‾r(t)\overline{cp}_{r(t)} is the value per period of the reference period r(t)r(t): the annual sum of the previous year divided by the frequency ff (reference_freq = 1), the value of the previous period (reference_freq = f) or the value of the period reference_cycle of the previous year.

Value

A ts (or mts) of volume indices (reference period = 100).

References

International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.

Examples

# Volume indices over the previous year (previous-year prices)
cp_pi2vol(imf_cp, imf_pi)
# Volume indices over the previous quarter (price indices over the previous quarter)
cp_pi2vol(imf_cp, pi_py2pp(imf_pi), reference_freq = 4)
# Volume indices over the last quarter of the previous year
cp_pi2vol(imf_cp, imf_pi, reference_freq = 4, reference_cycle = 4)

Data of the IMF Quarterly National Accounts Manual (chapter 8)

Description

Current prices and price indices of two products (A and B) used in the examples of the chapter 8 (price and volume measures) of the IMF Quarterly National Accounts Manual. imf_cp and imf_pi are current prices and elementary price indices over the previous year (average of the previous year = 100) of the example 8.2. The price indices are not available in 2010 (reference year).

Usage

imf_cp

imf_pi

Format

Quarterly mts from 2010Q1 to 2013Q4 with two columns (A and B).

An object of class mts (inherits from ts, matrix) with 16 rows and 2 columns.

Source

Tables and charts of the examples of the chapter 8 (Price and Volume Measures) of the IMF Quarterly National Accounts Manual (2017 Edition), doi:10.5089/9781475589870.069.

References

International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.

Examples

imf_cp
imf_pi

Contributions to percent change of a Fisher volume index

Description

Exact contributions of the components to the percent change, from the previous period (quarter, month or year) to the current one, of the Fisher volume index of their aggregate (equation (32) of the paragraph 8.89 of the IMF QNA Manual).

Usage

fisher_contrib(cp, pi, extra = NULL)

Arguments

cp

Current prices of all the components of the aggregate (ts or mts). The aggregate is their sum.

pi

Price indices of the components over the previous period (previous quarter, month or year = 100), with the same structure as cp. Price indices over the previous year can be converted with pi_py2pp().

extra

Additional columns: "total" adds the percent change of the Fisher volume index, and "residual" the difference between this percent change and the sum of the contributions (zero, up to numerical errors).

Details

With xtx^t the current price value of the component xx in period tt, ztz^t the one of the aggregate, rj=pjt/pjt−1r_j = p_j^t / p_j^{t-1} the price index of the component jj over the previous period, and FF the Fisher volume index of the aggregate (previous period = 1), the contribution of the component xx is

100ztzt−1(xt/rx−xt−1)+F(xt−xt−1rx)zt+F∑jxjt−1rj.100 \frac{\frac{z^t}{z^{t-1}} \left(x^t / r_x - x^{t-1}\right) + F \left(x^t - x^{t-1} r_x\right)}{z^t + F \sum_j x_j^{t-1} r_j}.

Contributions add up exactly to the percent change of the Fisher index, whatever the number of components.

The formula as printed in the manual has the ratio zt−1/ztz^{t-1} / z^t in the first term and xt−1pxt−1/pxtx^{t-1} p_x^{t-1} / p_x^t in the second one. With these ratios the contributions do not add up to the percent change (checked numerically), so that the formula implemented corrects them (zt/zt−1z^t / z^{t-1} and xt−1pxt/pxt−1x^{t-1} p_x^t / p_x^{t-1}, consistent with the denominator). Among the variants of the formula that were tested, it is the only one that is exact.

The adjustments that some countries add to the quarterly contributions (benchmarking of the quarterly Fisher indices on the annual ones, percent changes at annual rates) are not done. As recommended by the manual (paragraph 8.90), the contribution of a variable that can be negative, zero or positive (such as changes in inventories) should be calculated residually, as the difference between the contribution of the aggregate that includes it and the contributions of the other components.

Value

A ts (or mts) of contributions, in percentage points, with the span and the columns of cp (followed by Total and/or Residual). The first period is NA.

References

Chevalier, M. (2003), "Chain Fisher Volume Index Methodology", Statistics Canada (formula drawn from the appendix II).

International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.

See Also

fisher(), chain_contrib()

Examples

# Price indices over the previous quarter (example 8.4)
ep <- pi_py2pp(imf_pi)
fisher_contrib(imf_cp, ep, extra = c("total", "residual"))

Laspeyres, Paasche and Fisher volume indices

Description

Derive the Laspeyres-type, Paasche-type or Fisher-type volume indices of the total from the current prices and the price indices of its components.

Usage

laspeyres(
  cp,
  pi,
  output = c("index", "measure", "both"),
  reference_freq = 1,
  reference_cycle = NULL
)

paasche(
  cp,
  pi,
  output = c("index", "measure", "both"),
  reference_freq = 1,
  reference_cycle = NULL
)

fisher(
  cp,
  pi,
  output = c("index", "measure", "both"),
  all_index = FALSE,
  reference_freq = 1,
  reference_cycle = NULL
)

Arguments

cp

Current prices (ts or mts).

pi

Price indices (previous reference period = 100), same structure as cp.

output

Character if the output should be the volume index (the default), the volume measure (in monetary terms) or both.

reference_freq

Frequency of the reference period: 1 (default) for the previous year, or the frequency of the data (4 or 12) for the previous period (quarter or month). It must divide the frequency of cp.

reference_cycle

Integer to use a given period of the previous year as reference (the last period of the year, 4 for quarterly data or 12 for monthly data) instead of the average of the year, as needed for the one-quarter overlap technique. It is used with reference_freq equal to the frequency of cp. The reference period is valued at its own current prices: the one-quarter overlap technique of the manual values it at the average prices of the year, see chain_laspeyres() and cp_pi2cy().

all_index

(fisher() only) Boolean: if TRUE, return the Laspeyres, Paasche and Fisher indices instead of the Fisher index only.

Details

With vi,tv_{i,t} the elementary volume index of the component ii (cp_pi2vol()), wi,rw_{i,r} its share in the current prices of the total in the reference period rr (the previous year, by default) and wi,cw_{i,c} its share in the current period cc (the current year, by default):

Lt=∑iwi,r vi,t,Pt=(∑iwi,cvi,t)−1,Ft=LtPt.L_t = \sum_i w_{i,r}\, v_{i,t}, \qquad P_t = \left(\sum_i \frac{w_{i,c}}{v_{i,t}}\right)^{-1}, \qquad F_t = \sqrt{L_t P_t}.

The volume measure is the index times the value per period of the total in the reference period, divided by 100.

Value

A ts (or mts).

References

International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.

Examples

# Laspeyres-type volume index over the previous year
laspeyres(imf_cp, imf_pi)
# Volume index and measure (in monetary terms)
paasche(imf_cp, imf_pi, output = "both")
# The three indices
fisher(imf_cp, imf_pi, all_index = TRUE)
# Quarter-to-quarter indices need price indices over the previous quarter
fisher(imf_cp, pi_py2pp(imf_pi), reference_freq = 4)

Annual price indices

Description

Annual price indices (previous year average = 100) derived from quarterly or monthly price indices over the previous year.

Usage

pi_annual(pi, cp = NULL, method = c("weighted", "mean"))

Arguments

pi

Quarterly or monthly price indices over the previous year (previous year average = 100), ts or mts.

cp

Current prices, with the same structure as pi. Needed for method = "weighted".

method

"weighted" (default) for the weighted average of the price indices (implicit annual price index), "mean" for their simple average.

Details

With method = "weighted" (the default), the annual price index is the weighted average of the sub-annual price indices, the weights being the volumes at the prices of the previous year (cp/pi×100cp / pi \times 100): it is the implicit price index, i.e. the annual current prices divided by the annual sum of the sub-annual volumes at the prices of the previous year,

piy=100×∑qcpq∑qcpq/piq×100.pi_y = 100 \times \frac{\sum_q cp_q}{\sum_q cp_q / pi_q \times 100}.

It is consistent with the sub-annual data (as the unit value in example 8.1 of the IMF QNA Manual): the annual volume at the prices of the previous year is the annual sum of the sub-annual ones. This is what is used in examples 8.3, 8.8 and 8.9 of the manual, and by cp_pi2cy().

With method = "mean", the annual price index is the simple average of the sub-annual price indices: the annual volumes are then not exactly the annual sums of the sub-annual ones.

The sub-annual price indices themselves are normalised on the simple average of the previous year (see pi_py2pp()): this is not affected by method.

Value

An annual ts (or mts) with the structure of pi. It is NA for the incomplete years and the years without price indices (e.g. the reference year).

References

International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.

See Also

cp_pi2cy(), pi_py2pp()

Examples

pi_annual(imf_pi, imf_cp)
pi_annual(imf_pi, method = "mean")
# Annual Fisher volume index (previous year = 100)
fisher(stats::aggregate(imf_cp), pi_annual(imf_pi, imf_cp))

Price indices over the previous period

Description

Convert price indices expressed over the previous year (average of the previous year = 100, as in the examples 8.2 and 8.3 of the IMF QNA Manual) into price indices over the previous period (quarter or month), as needed by laspeyres(), paasche() and fisher() with reference_freq equal to the frequency of the data.

Usage

pi_py2pp(pi, previous = 100)

Arguments

pi

Price indices over the previous year (ts or mts, quarterly or monthly). Leading and trailing missing values are ignored.

previous

Value, over the previous year, assumed for the period before the first one (default: 100, i.e. the prices of that period are those of the average of its year).

Details

With iti_t the index over the previous year, the index over the previous period is 100it/it−1100 i_t / i_{t-1} within a year, and it/it−1×iˉy−1i_t / i_{t-1} \times \bar{i}_{y-1} for the first period of year yy (iˉy−1\bar{i}_{y-1} is the simple average of the indices of the previous year, on which the indices of year y−1y-1 are normalised). This simple average is the normalisation of the indices, not the annual price index used to deflate annual data, which is by default their weighted average (see pi_annual()).

Value

A ts (or mts) of price indices (previous period = 100).

References

International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.

See Also

pi_annual()

Examples

pi_py2pp(imf_pi)