View source: R/HierarchyContributors.R
HierarchyContributors | R Documentation |
Counts of input code contributions
HierarchyContributors(data, x, crossTable, hierarchies, inputInOutput = TRUE)
data |
input data |
x |
model matrix as created by |
crossTable |
|
hierarchies |
Standardized hierarchies. That is, output from |
inputInOutput |
|
List of data frames of counts associated with crossTable
min
: Minimum number of times a contributing input code contributes
max
: Maximum number of times a contributing input code contributes
n
: Number of contributing input codes
ac
: Theoretical number of contributing input codes according to the hierarchy
z <- SSBtoolsData("sprt_emp_withEU")[-(1:3), ]
z$age[z$age == "Y15-29"] <- "young"
z$age[z$age == "Y30-64"] <- "old"
hi <- SSBtools::FindHierarchies(z[, -4])
inputInOutput <- c(TRUE, FALSE, FALSE)
mm <- SSBtools::ModelMatrix(z, hi, crossTable = TRUE, inputInOutput = inputInOutput)
out <- HierarchyContributors(z, mm$modelMatrix, mm$crossTable, hi, inputInOutput)
# The nonzero values are caused by the removed three data rows
cbind(mm$crossTable, out$max - out$min)
cbind(mm$crossTable, out$ac - out$n)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.