# NOT RUN {
# Example 1: Real-life crisp-set data, d.educate.
(res_opt1 <- cnaOpt(d.educate, "E"))
# Using the pipe operator (%>%), the steps processed by cnaOpt in the
# call above can be reproduced as follows:
library(dplyr)
conCovOpt(d.educate, "E") %>% selectMax %>% DNFbuild("E", reduce = "ereduce") %>%
paste("<-> E") %>% condTbl(d.educate)
# Example 2: Simulated crisp-set data.
dat1 <- data.frame(
A = c(1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0),
B = c(0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0),
C = c(0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0),
D = c(1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1),
E = c(1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1),
F = c(0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1)
)
(res_opt2 <- cnaOpt(dat1, "E"))
# Change the optimality criterion.
cnaOpt(dat1, "E", crit = quote(pmin(con, cov)))
# Impose an additional condition.
# }
# NOT RUN {
cnaOpt(dat1, "E", cond = quote(con >= 0.9))
# }
# NOT RUN {
# Example 3: All logically possible configurations.
(res_opt3 <- cnaOpt(full.tt(4), "D")) # All combinations are equally bad.
# Example 4: Real-life multi-value data, d.pban.
cnaOpt(mvtt(d.pban), outcome = "PB=1")
# }
# NOT RUN {
cnaOpt(mvtt(d.pban), outcome = "PB=1", crit = quote(pmin(con, cov)))
# }
# NOT RUN {
cnaOpt(mvtt(d.pban), outcome = "PB=1", cond = quote(con > 0.93))
# }
# NOT RUN {
cnaOpt(mvtt(d.pban), outcome = "PB=0")
cnaOpt(mvtt(d.pban), outcome = "PB=0", cond = quote(con > 0.93))
cnaOpt(d.pban, type = "mv", outcome = "F=2")
cnaOpt(d.pban, type = "mv", outcome = "F=2", cond = quote(con > 0.75))
# }
Run the code above in your browser using DataLab