# NOT RUN {
# Generate fake data
set.seed(1234)
a <- runif(100, 0, 1)
b <- runif(100, 0, 1)
c <- runif(100, 0, 1)
y <- runif(100, 0, 1)
# Only one condition, for sufficiency
QCAfit(a, y, cond.lab = "A")
# With three conditions, for sufficiency
QCAfit(cbind(a, b, c), y, cond.lab = c("A", "B", "C"))
# Only one condition, for necessity
QCAfit(a, y, cond.lab = "A", necessity = TRUE)
# With three conditions, for necessity
QCAfit(cbind(a, b, c), y, cond.lab = c("A", "B", "C"), necessity = TRUE)
# With three conditions and negated output, for sufficiency
QCAfit(cbind(a, b, c), y, cond.lab = c("A", "B", "C"), neg.out = TRUE)
# Load the Schneider data:
data(SCHF)
# Get parameters of fit for condition EMP as necessary for outcome EXPORT:
QCAfit(SCHF$EMP, SCHF$EXPORT, necessity = TRUE, cond.lab = "EMP")
# Get parameters of fit for condition ~EMP as necessary for outcome ~EXPORT:
QCAfit(1-SCHF$EMP, SCHF$EXPORT, neg.out=TRUE, necessity = TRUE, cond.lab = "~EMP")
# Get parameters of fit for all conditions as necessary for outcome EXPORT:
QCAfit(SCHF[,1:6], SCHF$EXPORT, necessity = TRUE, cond.lab = names(SCHF[,1:6]))
# Obtain the intermediate solution for outcome "EXPORT":
sol_yi <- minimize(SCHF, outcome = "EXPORT",
conditions = c("EMP","BARGAIN","UNI","OCCUP","STOCK", "MA"),
incl.cut = .9,
include = "?",
details = TRUE, show.cases = TRUE, dir.exp = c(0,0,0,0,0,0))
# Get parameters of fit for the second model of the intermediate solution:
QCAfit(x = sol_yi, y = "EXPORT", sol=2)
# Get parameters of fit for truth table rows 2,8, and 10:
QCAfit(x = sol_yi, y = "EXPORT", ttrows=c("2","8","10"))
# }
Run the code above in your browser using DataLab