Let’s suppose I have the following data frame:
mydata <- data.frame(cond1=c(0.9,0.6,0.9,0.5,0.2,0.2,0.9,0.7,0.1,0.1,0.6),
cond2=c(0.7,0.7,0.2,0.9,0.9,0.2,0.2,0.9,0.3,0.4,0.9),
cond3=c(0.8,0.9,1,0.3,0.6,0.2,0.3,0.1,0.9,0.1,1),
outcome=c(1,0.9,0.8,0.5,0.9,0.5,0.3,0.6,0.4,0.3,0.2))
I load QCA libray for a fuzzy Qualitative Comparative Analysis:
library(QCA)
Then I construct de truth table:
TT <- truthTable(mydata, outcome = "outcome", incl.cut1 = 0.85,
show.cases = TRUE, sort.by = c("incl", "n"))
And no problem, but when I try to get the Boolean minimization for the complex solution using the following code:
SC <- eqmcc(TT,details = T, show.cases = T)
I always get the error message:
Error in `[.data.frame`(data, , outcome) : undefined columns selected
What am I doing wrong?
Thanks.
There seems to be a bug in that function. At some point it seems to convert the outcome name to all upper-case. So if you change your column name in your data.frame and the column you use in the truthTable to uppercase "OUTCOME", it seems to work
library(QCA)
mydata <- data.frame(cond1=c(0.9,0.6,0.9,0.5,0.2,0.2,0.9,0.7,0.1,0.1,0.6),
cond2=c(0.7,0.7,0.2,0.9,0.9,0.2,0.2,0.9,0.3,0.4,0.9),
cond3=c(0.8,0.9,1,0.3,0.6,0.2,0.3,0.1,0.9,0.1,1),
OUTCOME=c(1,0.9,0.8,0.5,0.9,0.5,0.3,0.6,0.4,0.3,0.2))
TT <- truthTable(mydata, outcome = "OUTCOME", incl.cut1 = 0.85,
show.cases = TRUE, sort.by = c("incl", "n"))
eqmcc(TT,details = T, show.cases = T)
That produces
n OUT = 1/0/C: 7/3/0
Total : 10
Number of multiple-covered cases: 3
M1: COND3 + COND1*COND2 => OUTCOME
incl cov.r cov.u cases
----------------------------------------------------
1 COND3 0.758 0.734 0.281 3; 5; 1,2,11; 9
2 COND1*COND2 0.878 0.562 0.109 8; 1,2,11
----------------------------------------------------
M1 0.771 0.844