DominanceRule {GaussSuppression} | R Documentation |
(n,k)
rule for magnitude tablesSupports application of multiple values for n
and k
. The function works
on magnitude tables containing negative cell values by calculating
contribution based on absolute values.
DominanceRule(
data,
x,
numVar,
n,
k,
protectZeros = FALSE,
charVar = NULL,
sWeightVar = NULL,
domWeightMethod = "default",
allDominance = FALSE,
outputWeightedNum = !is.null(sWeightVar),
...
)
data |
the dataset |
x |
ModelMatrix generated by parent function |
numVar |
vector containing numeric values in the data set |
n |
parameter |
k |
parameter |
protectZeros |
parameter determining whether cells with value 0 should be suppressed. |
charVar |
Variable in data holding grouping information. Dominance will be calculated after aggregation within these groups. |
sWeightVar |
variable with sampling weights to be used in dominance rule |
domWeightMethod |
character representing how weights should be treated in the dominance rule. See Details. |
allDominance |
Logical parameter. If |
outputWeightedNum |
logical value to determine whether weighted numerical
value should be included in output. Default is |
... |
unused parameters |
This method only supports suppressing a single numeric variable. There are
multiple ways of handling sampling weights in the dominance rule. the default
method implemented here compares unweighted sample values with the corresponding
weighted cell totals. if domWeightMethod
is set to "tauargus"
, the
method implemented in tauArgus is used. For more information on this
method, see "Statistical Disclosure Control" by Hundepool et al (2012,
p. 151).
logical vector that is TRUE
in positions corresponding to cells
breaching the dominance rules.
Daniel Lupp
set.seed(123)
z <- SSBtools::MakeMicro(SSBtoolsData("z2"), "ant")
z$value <- sample(1:1000, nrow(z), replace = TRUE)
GaussSuppressionFromData(z, dimVar = c("region", "fylke", "kostragr", "hovedint"),
numVar = "value", candidates = CandidatesNum, primary = DominanceRule, preAggregate = FALSE,
singletonMethod = "sub2Sum", n = c(1, 2), k = c(65, 85), allDominance = TRUE)
num <- c(100,
90, 10,
80, 20,
70, 30,
50, 25, 25,
40, 20, 20, 20,
25, 25, 25, 25)
v1 <- c("v1",
rep(c("v2", "v3", "v4"), each = 2),
rep("v5", 3),
rep(c("v6", "v7"), each = 4))
sw <- c(1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1)
d <- data.frame(v1 = v1, num = num, sw = sw)
# without weights
GaussSuppressionFromData(d, formula = ~v1 - 1,
numVar = "num", n = c(1,2), k = c(80,70),
preAggregate = FALSE, allDominance = TRUE, candidates = CandidatesNum,
primary = DominanceRule)
# with weights, standard method
GaussSuppressionFromData(d, formula = ~v1 - 1,
numVar = "num", n = c(1,2), k = c(80,70), sWeightVar = "sw",
preAggregate = FALSE, allDominance = TRUE, candidates = CandidatesNum,
primary = DominanceRule)
# with weights, tauargus method
GaussSuppressionFromData(d, formula = ~v1 - 1,
numVar = "num", n = c(1,2), k = c(80,70), sWeightVar = "sw",
preAggregate = FALSE, allDominance = TRUE, candidates = CandidatesNum,
primary = DominanceRule, domWeightMethod = "tauargus")