| 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 |
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).
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") )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") )
vo |
Chain volume measures (in monetary terms) of the components
( |
cp |
Current prices of the components (same number of columns as |
vo_total |
Chain volume measure of the total ( |
cp_total |
Current prices of the total. By default, the sum of |
method |
Chain-linking technique used to compute |
type |
Growth to decompose: |
base_year |
Reference year of the chain measures. By default, the year
before the start of |
extra |
Additional columns: |
pi |
Price indices of the components over the previous year (previous year
average = 100), needed for |
overlap_prices |
Only for |
Let be the chain volume measure of a component and the
one of the total. Within year , the total is exactly
, where is the
relative price (price of the component / price of the total) of the
previous year:
method = "ao": 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 and a period
(previous period, same period of the previous year, or previous year) is
where (annual overlap) or the share of the overlap
period (one-quarter overlap). The second term is zero when and
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.
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).
International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.
chain_laspeyres(), chain_link(), chain_discrepancy(),
fisher_contrib()
# 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")# 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")
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,
with the chain volume measures of the components and
the one of the total ( with relative = TRUE).
chain_discrepancy(vo, vo_total = NULL, relative = FALSE)chain_discrepancy(vo, vo_total = NULL, relative = FALSE)
vo |
Chain volume measures (in monetary terms) of the components ( |
vo_total |
Chain volume measure of the total ( |
relative |
Boolean: if |
A ts: sum of the chain volume measures of the components minus the
chain volume measure of the total.
International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.
x <- chain_laspeyres(imf_cp, imf_pi, method = "ao", base_year = 2010, output = "measure") chain_discrepancy(x) chain_discrepancy(x, relative = TRUE)x <- chain_laspeyres(imf_cp, imf_pi, method = "ao", base_year = 2010, output = "measure") chain_discrepancy(x) chain_discrepancy(x, relative = TRUE)
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.
chain_laspeyres( cp, pi, method = c("ao", "oqo"), base_year = NULL, output = c("index", "measure", "both"), overlap_prices = c("year_prices", "current_prices") )chain_laspeyres( cp, pi, method = c("ao", "oqo"), base_year = NULL, output = c("index", "measure", "both"), overlap_prices = c("year_prices", "current_prices") )
cp |
Current prices of the components ( |
pi |
Price indices of the components over the previous year (previous
year average = 100), with the same structure as |
method |
Chain-linking technique: |
base_year |
Reference year (index = 100). By default, the year before the
start of |
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 |
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:
where is the value of the last period of year .
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().
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()).
International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.
chain_contrib(), chain_discrepancy(), cp_pi2cy()
# 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")# 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")
Chain-linking of volume indices. chain_link() links sub-annual (quarterly or
monthly) volume indices with the annual overlap ("ao") or the one-quarter
overlap ("oqo") technique; annual_chain() chains annual links.
chain_link( vo, cp = NULL, method = c("ao", "oqo"), base_year = NULL, output = c("index", "measure", "both") ) annual_chain( vo, cp = NULL, base_year = NULL, output = c("index", "measure", "both") )chain_link( vo, cp = NULL, method = c("ao", "oqo"), base_year = NULL, output = c("index", "measure", "both") ) annual_chain( vo, cp = NULL, base_year = NULL, output = c("index", "measure", "both") )
vo |
Volume indices (
|
cp |
Current prices, optional (same number of variables as |
method |
Chain-linking technique: |
base_year |
Reference year (index = 100). By default, the year before the
start of |
output |
Chain index (the default), chain volume measure (in monetary terms, i.e. the index times the base-year current prices) or both. |
With the volume index of period (year ) over the
reference of the previous year, the annual link of year is
(annual average, "ao" and annual_chain())
or (overlap period, the last one of the year,
"oqo"). With the reference year , the chain level of year is
() and the
chain index is
for sub-annual series (chain_link()) and for
annual series (annual_chain()). The chain volume measure is
, with the annual current prices of the
reference year and the frequency (1 for annual_chain()).
To compute the volume indices of a total from its components, see
chain_laspeyres().
A ts (or mts). With output = "both", the columns are the
indices then the measures of each variable.
International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.
# Annual overlap: volume indices over the previous year vo <- cp_pi2vol(imf_cp, imf_pi) chain_link(vo, imf_cp, method = "ao", base_year = 2010) chain_link(vo, imf_cp, method = "ao", base_year = 2010, output = "measure") # One-quarter overlap: the volume indices over the overlap quarter are built by # chain_laspeyres(), which also chains them chain_laspeyres(imf_cp, imf_pi, method = "oqo", base_year = 2010) # Annual chain index from annual Fisher indices fis <- fisher(stats::aggregate(imf_cp), pi_annual(imf_pi, imf_cp)) annual_chain(fis, base_year = 2010)# Annual overlap: volume indices over the previous year vo <- cp_pi2vol(imf_cp, imf_pi) chain_link(vo, imf_cp, method = "ao", base_year = 2010) chain_link(vo, imf_cp, method = "ao", base_year = 2010, output = "measure") # One-quarter overlap: the volume indices over the overlap quarter are built by # chain_laspeyres(), which also chains them chain_laspeyres(imf_cp, imf_pi, method = "oqo", base_year = 2010) # Annual chain index from annual Fisher indices fis <- fisher(stats::aggregate(imf_cp), pi_annual(imf_pi, imf_cp)) annual_chain(fis, base_year = 2010)
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.
chain_pseudo( cp_pos, pi_pos, cp_neg, pi_neg, method = c("ao", "oqo"), base_year = NULL )chain_pseudo( cp_pos, pi_pos, cp_neg, pi_neg, method = c("ao", "oqo"), base_year = NULL )
cp_pos |
Current prices of the series that takes positive values ( |
pi_pos |
Price indices of |
cp_neg, pi_neg
|
The same for the series that is subtracted (opening inventories, imports, etc.). |
method |
Chain-linking technique: |
base_year |
Reference year (index = 100). By default, the year before the
start of |
With and the chain volume measures of the two
series (chain_laspeyres()), the pseudo chain volume series is
.
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.
A ts: the chain volume measure (in monetary terms) of cp_pos minus
the one of cp_neg.
International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.
chain_laspeyres(), chain_contrib()
# 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)# 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)
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 the new reference year,
where is the average of the index over the periods of year
, and and the annual sums of the current prices and
of the measure.
chain_rebase(x, base_year, cp = NULL)chain_rebase(x, base_year, cp = NULL)
x |
Chain index (if |
base_year |
New reference year. |
cp |
Current prices, same structure as |
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).
A ts (or mts) with the same structure as x.
International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.
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)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)
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).
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") )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") )
x |
Chain volume measures (in monetary terms) of the components ( |
cp |
Current prices of the components (same number of variables as |
method |
Chain-linking technique of |
base_year |
Reference year of the chain measures. By default, the year
before the start of |
pi |
Price indices of the components over the previous year (previous year
average = 100), needed for |
overlap_prices |
Only for |
output |
( |
cp_total |
( |
To derive the seasonally adjusted aggregate of seasonally adjusted chain-linked components:
seasonally adjust the chain volume measures of the components (outside the package);
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);
aggregate them and chain-link the aggregate (again with the same technique);
re-reference it to the reference year.
With the chain volume measure of a component, the reference
year, the frequency and the chain level of year
(see chain_link()), the volume at the prices of the previous year is
where is the value of the reference of year : the annual
current prices divided by (annual overlap) or the value of the overlap
period (one-quarter overlap). The volume index of the aggregate is then
, 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.
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").
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.
chain_link(), chain_laspeyres()
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")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")
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.
cp_pi2cy(cp, pi)cp_pi2cy(cp, pi)
cp |
Current prices ( |
pi |
Price indices over the previous year (previous year average = 100),
with the same structure as |
The value is the volume measure at the prices of the previous year,
multiplied by the annual price index of the year (the annual current
prices divided by the annual sum of the volume measures at the prices of the
previous year, see pi_annual()):
so that the annual sum of is the annual current price 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).
International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.
chain_laspeyres(), chain_contrib(), pi_annual()
cp_pi2cy(imf_cp, imf_pi)cp_pi2cy(imf_cp, imf_pi)
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).
cp_pi2vol(cp, pi, reference_freq = 1, reference_cycle = NULL)cp_pi2vol(cp, pi, reference_freq = 1, reference_cycle = NULL)
cp |
Current prices ( |
pi |
Price indices (previous reference period = 100), same structure as |
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 |
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 |
With the current prices and the price index of period
, the volume index is
where is the value per period of the reference
period : the annual sum of the previous year divided by the frequency
(reference_freq = 1), the value of the previous period
(reference_freq = f) or the value of the period reference_cycle of the
previous year.
A ts (or mts) of volume indices (reference period = 100).
International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.
# 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)# 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)
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).
imf_cp imf_piimf_cp imf_pi
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.
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.
International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.
imf_cp imf_piimf_cp imf_pi
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).
fisher_contrib(cp, pi, extra = NULL)fisher_contrib(cp, pi, extra = NULL)
cp |
Current prices of all the components of the aggregate ( |
pi |
Price indices of the components over the previous period (previous
quarter, month or year = 100), with the same structure as |
extra |
Additional columns: |
With the current price value of the component in period
, the one of the aggregate,
the price index of the component over the previous period, and
the Fisher volume index of the aggregate (previous period = 1), the
contribution of the component is
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 in the
first term and 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
( and , 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.
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.
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.
# Price indices over the previous quarter (example 8.4) ep <- pi_py2pp(imf_pi) fisher_contrib(imf_cp, ep, extra = c("total", "residual"))# Price indices over the previous quarter (example 8.4) ep <- pi_py2pp(imf_pi) fisher_contrib(imf_cp, ep, extra = c("total", "residual"))
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.
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 )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 )
cp |
Current prices ( |
pi |
Price indices (previous reference period = 100), same structure as |
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 |
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 |
all_index |
( |
With the elementary volume index of the component
(cp_pi2vol()), its share in the current prices of the total in
the reference period (the previous year, by default) and
its share in the current period (the current year, by default):
The volume measure is the index times the value per period of the total in the reference period, divided by 100.
A ts (or mts).
International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.
# 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)# 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 (previous year average = 100) derived from quarterly or monthly price indices over the previous year.
pi_annual(pi, cp = NULL, method = c("weighted", "mean"))pi_annual(pi, cp = NULL, method = c("weighted", "mean"))
pi |
Quarterly or monthly price indices over the previous year (previous
year average = 100), |
cp |
Current prices, with the same structure as |
method |
|
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 (): 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,
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.
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).
International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.
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))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))
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.
pi_py2pp(pi, previous = 100)pi_py2pp(pi, previous = 100)
pi |
Price indices over the previous year ( |
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). |
With the index over the previous year, the index over the previous
period is within a year, and
for the first period of year
( is the simple average of the indices of the previous year,
on which the indices of year 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()).
A ts (or mts) of price indices (previous period = 100).
International Monetary Fund (2018), Quarterly National Accounts Manual (2017 Edition), chapter 8 "Price and Volume Measures", Washington, DC. doi:10.5089/9781475589870.069.
pi_py2pp(imf_pi)pi_py2pp(imf_pi)