| Z_byname | R Documentation |
X_0 and X_T matricesThe formula for Z is
Z_ij = logmean(v_Ti1, v_0i1) * log(X_Tij / X_0ij)
where v is a column vector formed by row products of X.
The 0 and T subscripts on X and v indicate an initial time (0)
and a final time (T).
The i and j subscripts on Z, v, and X are
matrix indices.
Z_byname(X_0, X_T, fillrow = NULL)
X_0 |
an |
X_T |
an |
fillrow |
a row vector of type |
Z and X are category-by-factor matrices, and
v is a category-by-1 column vector.
When a category comes and goes through time,
the category row can be absent from the X matrix at one time
but present in the X matrix at an adjacent time.
If the missing category row is replaced by 0s,
the LMDI algorithm fails due to log(0) errors.
The usual advice is to insert a row consisting not of 0s
but rather filled with small numbers (e.g., 1e-10).
But the usual advice doesn't represent reality for some LMDI decomposition analyses.
For example, the missing row may be caused by only one of the many factors being zero,
the other factors being non-zero.
To provide greater flexibility, this function provides the fillrow argument.
Callers can supply their own fillrow,
a single-row matrix with column names identical
to X_0 and X_T.
If fillrow is not specified,
the usual advice will be followed, and
a row vector consisting of very small values (1e-10)
for each factor will be inserted into
X_0 or X_T, as appropriate.
Note that the lmdi() function passes its fillrow argument, if present,
to Z_byname.
The nomenclature for this function comes from
Ang, Zhang, and Choi (1998).
This function fully accounts for the degenerate cases
found in Table 2, p. 492 of
Ang, Zhang, and Choi (1998).
When 0s are encountered in emptyrow,
this function employs the method for dealing with the log(0) problem suggested by
Wood and Lenzen (2006).
A Z matrix.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.