| unbalance_hierarchy | R Documentation |
A hierarchy with L upper levels is said to be balanced if each variable
at level l has at least one child at level l+1. When this doesn't
hold, the hierarchy is unbalanced. This function transforms an aggregation
matrix of a balanced hierarchy into an aggregation matrix of an unbalanced
one, by removing possible duplicated series.
unbalance_hierarchy(agg_mat, more_info = FALSE, sparse = TRUE)
agg_mat |
A ( |
more_info |
If |
sparse |
Option to return sparse matrices (default is
|
A list containing four
elements (more_info = TRUE):
ubm |
The aggregation matrix of the unbalanced hierarchy. |
agg_mat |
The input matrix. |
idrm |
The identification number of the duplicated variables (row
numbers of the aggregation matrix |
id |
The identification number of each variable in the balanced hierarchy. It may contains duplicated values. |
Utilities:
FoReco2matrix(),
aggts(),
as_ctmatrix(),
as_tevector(),
balance_hierarchy(),
commat(),
csprojmat(),
cstools(),
ctprojmat(),
cttools(),
df2aggmat(),
lcmat(),
recoinfo(),
res2matrix(),
set_bounds(),
shrink_estim(),
shrink_oasd(),
teprojmat(),
tetools()
# Balanced -> Unbalanced
# T T
# |-------| |-------|
# A B A |
# |---| | |---| |
# AA AB BA AA AB BA
A <- matrix(c(1, 1, 1,
1, 1, 0,
0, 0, 1), 3, byrow = TRUE)
obj <- unbalance_hierarchy(agg_mat = A)
obj
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.