0

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.

lc.
  • 113,939
  • 20
  • 158
  • 187
perevales
  • 81
  • 1
  • 6

2 Answers2

1

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 
MrFlick
  • 195,160
  • 17
  • 277
  • 295
0

After contacting the package developer he told me that this is bug and it is fixed in the latest build of QCA:

https://r-forge.r-project.org/R/?group_id=885

Then I tried with the latest build and now it works like a charm.

perevales
  • 81
  • 1
  • 6