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")
Run the code above in your browser using DataLab