Internet-Defense-League

2011-07-09

Index decomposition with R

Few days ago, I finally finished a small package ida. It enables you to analyse contributions of underlying factors to the change in an aggregate, using methods based on index number theory. These methods have become popular by, but are not restricted to, investigating the change of CO2 emissions.

Here is a chart that shows what the change of population, welfare, efficiency and fuel substitution contributed to CO2 emissions:

The numbers refer to Gt CO2. The data comes from Worldbank, however we treated missing values rather uncautious here. So the result may or may not be valid. However, it puts the efforts in perspective: Clearly the reduction of the energy use per GDP has not been capable to compensate the additional emissions from population growth and income per capita growth. The carbon intensity, i.e. the emissions per energy unit, remained nearly unchanged.

Here is how to produce the chart:

First, you need the package ida, and — for this example — its suggested dependencies. The ida package is not yet on CRAN, but on a self-hosted repository. Here is how to install

Now we can calculate the contribution of the four factors. Currently there are two methods implemented: the additive Laspeyres decomposition, which usually has a residual term of unexplained change; and the log-mean Divisia Index I decomposition, which is not really well defined for negative factors. More details on these and other methods can be found in Alexia van der Cruisse de Waizier’s thesis. We choose the latter method here