p2 <- price6[[2]]
p1 <- price6[[1]]
q2 <- quantity6[[2]]
q1 <- quantity6[[1]]
# Percent-change contributions for the Jevons index.
geometric_mean(p2 / p1) - 1
geometric_contributions(p2 / p1)
all.equal(
geometric_mean(p2 / p1) - 1,
sum(geometric_contributions(p2 / p1))
)
# Percent-change contributions for the Fisher index in section 6 of
# Reinsdorf et al. (2002).
(con <- fisher_contributions(p2 / p1, p1 * q1, p2 * q2))
all.equal(sum(con), fisher_index(p2, p1, q2, q1) - 1)
# Not the only way.
(con2 <- fisher_contributions2(p2 / p1, p1 * q1, p2 * q2))
all.equal(sum(con2), fisher_index(p2, p1, q2, q1) - 1)
# The same as the van IJzeren decomposition in section 4.2.2 of
# Balk (2008).
Qf <- quantity_index(fisher_index)(q2, q1, p2, p1)
Ql <- quantity_index(laspeyres_index)(q2, q1, p1)
wl <- scale_weights(p1 * q1)
wp <- scale_weights(p1 * q2)
(Qf / (Qf + Ql) * wl + Ql / (Qf + Ql) * wp) * (p2 / p1 - 1)
# Similar to the method in section 2 of Reinsdorf et al. (2002),
# although those contributions aren't based on weights that sum to 1.
Pf <- fisher_index(p2, p1, q2, q1)
Pl <- laspeyres_index(p2, p1, q1)
(1 / (1 + Pf) * wl + Pl / (1 + Pf) * wp) * (p2 / p1 - 1)
# Also similar to the decomposition by Hallerbach (2005), noting that
# the Euler weights are close to unity.
Pp <- paasche_index(p2, p1, q2)
(0.5 * sqrt(Pp / Pl) * wl + 0.5 * sqrt(Pl / Pp) * wp) * (p2 / p1 - 1)
Run the code above in your browser using DataLab