# Example inspired by suppression with maxN = 5
d1 <- SSBtoolsData("d1")
mm <- SSBtools::ModelMatrix(d1, dimVar = 1:2, crossTable = TRUE)
x <- mm$modelMatrix
y <- Matrix::crossprod(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.
Run the code above in your browser using DataLab