## Two hierarchy sharing the same top-level variable, but not sharing the bottom variables
# X X
# |-------| |-------|
# A B C D
# |---|
# A1 A2
# 1) X = C + D,
# 2) X = A + B,
# 3) A = A1 + A2.
cons_mat <- matrix(c(1,-1,-1,0,0,0,0,
1,0,0,-1,-1,0,0,
0,0,0,1,0,-1,-1), nrow = 3, byrow = TRUE)
obj <- lcmat(cons_mat = cons_mat, verbose = TRUE)
agg_mat <- obj$agg_mat # linear combination matrix
pivot <- obj$pivot # Pivot vector
Run the code above in your browser using DataLab