compare_indices_jk {PriceIndices} | R Documentation |
A general function to compare indices by using the jackknife method
Description
This function presents a comparison of selected indices obtained by using the jackknife method.
Usage
compare_indices_jk(
data,
start,
end,
by = "prodID",
formula = c(),
window = c(),
splice = c(),
base = c(),
sigma = c(),
r = c(),
names = c(),
title_iterations = c(),
title_pseudovalues = c()
)
Arguments
data |
The user's data frame with information about sold products. It must contain columns: |
start |
The base period (as character) limited to the year and month, e.g. "2019-12". |
end |
The research period (as character) limited to the year and month, e.g. "2020-04". |
by |
A character string which indicates a column name for creating product subgroups (in the classical jackknife method |
formula |
A vector of character strings indicating price index formulas that are to be calculated. To see available options please use the link: |
window |
A vector of integers. Each element of the vector defines the length of the time window of the corresponding multilateral index. |
splice |
A vector of character strings. Each element of the vector indicates the splicing method is to be used for the corresponding multilateral index. Available values of vector elements are: "movement", "window","half","mean" and their additional variants: "window_published", "half_published" and "mean_published". |
base |
The vector of prior periods used in the Young- or Lowe-type price indices or hybrid/geohybrid index. Each element of the vector (as character) must be limited to the year and month, e.g. "2020-01". |
sigma |
The vector of elasticity of substitution parameters used in the Lloyed-Moulton, AG Mean or GEKS-LM indices (as numeric). |
r |
The vector of non-zero parameters used in the quadratic mean of order r quantity / price index or in the GEKS-QM index (as numeric). |
names |
A vector of strings indicating names of indices which are to be used in the resulting data frame. |
title_iterations |
A character string indicating a title of the created box-plot for iteration index values. |
title_pseudovalues |
A character string indicating a title of the created box-plot for obtained (jackknife) index pseudovalues. |
Value
This function presents a comparison of selected indices obtained by using the jackknife method. In particular, it returns a list with four elements: iterations
, which is a data frame with basic characteristics of the calculated iteration index values (means, standard deviations, coefficients of variation and results for all sample), pseudovalues
, which is a data frame with basic characteristics of the calculated index pseudovalues obtained in the jackknife procedure (i.e. the jackknife estimators and their standard deviations and coefficients of variation), figure_iterations
which presents a box-plot for the calculated iteration index values, and figure_pseudovalues
which presents a box-plot for the calculated index pseudovalues obtained in the jackknife procedure.
References
Quenouille, M.H. (1956). Notes on bias in estimation. Biometrika, 43 (3–4), 353–360
(2004). Consumer Price Index Manual. Theory and practice. ILO/IMF/OECD/UNECE/Eurostat/The World Bank, International Labour Office (ILO), Geneva.
Examples
milk.<-dplyr::filter(milk, milk$prodID %in%
sample(unique(milk$prodID),4))
#creating a list with jackknife results
comparison<-compare_indices_jk(milk.,
formula=c("jevons","fisher"),
start="2018-12",
end="2019-12",
names=c("Jevons","Fisher"),
title_iterations="Box-plots for iteration values (milk products)",
title_pseudovalues="Box-plots for pseudovalues (milk products)")
#displaying results
comparison$iterations
comparison$pseudovalues
comparison$figure_iterations
comparison$figure_pseudovalues