# Load sample data
data(sample_data)
# Set fixed thresholds for conditions
thrX <- c(X1 = 7, X2 = 7, X3 = 7)
# === Three Types of QCA Solutions ===
# 1. Complex Solution (default, QCA compatible)
# Does not use logical remainders (most conservative)
result_comp <- otSweep(
dat = sample_data,
outcome = "Y",
conditions = c("X1", "X2", "X3"),
sweep_range = 7,
thrX = thrX
# include = "" (default), dir.exp = NULL (default)
)
head(result_comp$summary)
# 2. Parsimonious Solution (include = "?")
# Uses logical remainders without directional expectations
result_pars <- otSweep(
dat = sample_data,
outcome = "Y",
conditions = c("X1", "X2", "X3"),
sweep_range = 7,
thrX = thrX,
include = "?" # Include logical remainders
)
head(result_pars$summary)
# 3. Intermediate Solution (include = "?" + dir.exp)
# Uses logical remainders with directional expectations
result_int <- otSweep(
dat = sample_data,
outcome = "Y",
conditions = c("X1", "X2", "X3"),
sweep_range = 7,
thrX = thrX,
include = "?",
dir.exp = c(1, 1, 1) # All conditions expected positive
)
head(result_int$summary)
# === Threshold Sweep Example ===
# Sweep with complex solutions (default)
result_sweep <- otSweep(
dat = sample_data,
outcome = "Y",
conditions = c("X1", "X2", "X3"),
sweep_range = 6:8,
thrX = thrX
)
head(result_sweep$summary)
# Run with negated outcome (~Y)
# Analyzes conditions for Y < threshold
result_neg <- otSweep(
dat = sample_data,
outcome = "~Y",
conditions = c("X1", "X2", "X3"),
sweep_range = 6:8,
thrX = thrX
)
head(result_neg$summary)
Run the code above in your browser using DataLab