bpcTab {robCompositions} | R Documentation |
Backwards pivot coordinates and their inverse
Description
Backwards pivot coordinate representation of a compositional table as a special case of isometric logratio coordinates and their inverse mapping.
Usage
bpcTab(x, row.factor = NULL, col.factor = NULL, value = NULL, base = exp(1))
Arguments
x |
object of class data.frame with columns corresponding to row and column factors of the respective compositional table and a variable with the values of the composition (positive values only). |
row.factor |
name of the variable representing the row factor. Needs to be given with the quotation marks. |
col.factor |
name of the variable representing the column factor. Needs to be given with the quotation marks. |
value |
name of the variable representing the values of the composition. Needs to be given with the quotation marks. |
base |
a positive number: the base with respect to which logarithms are computed. Defaults to exp(1). |
Details
bpcTab
Backwards pivot coordinates map IxJ-part compositional table from the simplex into a (IJ-1)-dimensional real space isometrically. Particularly the first coordinate from each group (rbpb.1, cbpb.1, tbpc.1) preserves the elemental information on the two-factorial structure. The first row and column backwards pivot balances rbpb.1 and cbpb.1 represent two-factorial counterparts to the pairwise logratios. More specifically, the first two levels of the considered factor are compared in the ratio, while the first level plays the role of the rationing category (denominator of the ratio) and the second level is treated as the normalized category (numerator of the ratio). All categories of the complementary factor are aggregated with the geometric mean. The first table backwards pivot coordinate, has form of a four-part log odds-ratio (again related to the first two levels of the row and column factors) and quantifies the relations between factors. All coordinates are structured as detailed in Nesrstova et al. (2023).
Value
Coordinates |
array of orthonormal coordinates. |
Coordinates.ortg |
array of orthogonal coordinates. |
Contrast.matrix |
contrast matrix corresponding to the orthonormal coordinates. |
Base |
the base with respect to which logarithms are computed. |
Row.levels |
order of the row factor levels. |
Col.levels |
order of the column factor levels. |
Author(s)
Kamila Facevicova
References
Nesrstova, V., Jaskova, P., Pavlu, I., Hron, K., Palarea-Albaladejo, J., Gaba, A., Pelclova, J., Facevicova, K. (2023). Simple enough, but not simpler: Reconsidering additive logratio coordinates in compositional analysis. Submitted
See Also
bpc
bpcTabWrapper
bpcPcaTab
bpcRegTab
Examples
data(manu_abs)
manu_USA <- manu_abs[which(manu_abs$country=='USA'),]
manu_USA$output <- as.factor(manu_USA$output)
manu_USA$isic <- as.factor(manu_USA$isic)
# default setting with ln()
bpcTab(manu_USA, row.factor = "output", col.factor = "isic", value = "value")
# logarithm of base 2
bpcTab(manu_USA, row.factor = "output", col.factor = "isic", value = "value",
base = 2)
# for base exp(1) is the result similar to tabCoord():
r <- rbind(c(-1,1,0), c(-1,-1,1))
c <- rbind(c(-1,1,0,0,0), c(-1,-1,1,0,0), c(-1,-1,-1,1,0), c(-1,-1,-1,-1,1))
tabCoord(manu_USA, row.factor = "output", col.factor = "isic", value = "value",
SBPr = r, SBPc = c)