PrimaryFromRiskyDefault {GaussSuppression} | R Documentation |
Additional primary cells based on risky primary cells
Description
The algorithm uses parent-child relationships found from the model matrix (x
)
Usage
PrimaryFromRiskyDefault(x, y, risky, candidates, allDims = FALSE)
Arguments
x |
The model matrix |
y |
A vector of numeric values with a length equal to |
risky |
Indices to columns in |
candidates |
Indices to columns in |
allDims |
When TRUE, a primary cell is added for each dimension.
can be specified as a vector of length |
Details
For a single risky
cell, the algorithm can be formulated as:
Consider this cell as a
child
and identify allparents
that are present incandidates
.Remove parents who are also parents of other parents (i.e., eliminate higher-level parents).
Identify the children of these remaining parents that are included in
candidates
.Select the child that has the smallest value in the numeric variable (
y
).
For several risky
cells, coordination takes place. See the comment below the examples.
Value
Additional primary cells as indices to columns in x
.
Examples
# Example inspired by suppression with maxN = 5
d1 <- SSBtoolsData("d1")
mm <- SSBtools::ModelMatrix(d1, dimVar = 1:2, crossTable = TRUE)
x <- mm$modelMatrix
y <- t(x) %*% d1$freq
risky <- c(13, 15, 40, 45)
candidates <- c(1:12, 14, 16, 17, 19, 21, 21, 24, 26:37, 39, 42, 44)
info <- rep("", length(y))
info[risky ] <- "risky"
info[candidates] <- "c"
cbind(mm$crossTable, y=as.vector(y), info)
PrimaryFromRiskyDefault(x = x, y = y, risky = risky, candidates = candidates)
PrimaryFromRiskyDefault(x = x, y = y, risky = 40, candidates = candidates)
# The last solution (39) is not included in the first (28, 35).
# This is because 39 is not needed when 35 is already included.