0

假设我有以下数据框:

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))

我加载 QCA 库进行模糊定性比较分析:

library(QCA)

然后我构造了真值表:

TT <- truthTable(mydata, outcome = "outcome", incl.cut1 = 0.85,
                    show.cases = TRUE, sort.by = c("incl", "n"))

没问题,但是当我尝试使用以下代码为复杂解决方案获取布尔最小化时:

SC <- eqmcc(TT,details = T, show.cases = T)

我总是收到错误消息:

Error in `[.data.frame`(data, , outcome) : undefined columns selected

我究竟做错了什么?

谢谢。

4

2 回答 2

1

该功能似乎存在错误。在某些时候,它似乎将结果名称转换为全部大写。因此,如果您将 data.frame 中的列名和您在 truthTable 中使用的列更改为大写“OUTCOME”,它似乎可以工作

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)

那产生

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 
于 2014-07-11T01:08:02.340 回答
0

在联系了软件包开发人员后,他告诉我这是一个错误,它已在 QCA 的最新版本中修复:

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

然后我尝试了最新版本,现在它就像一个魅力。

于 2014-07-11T07:54:35.640 回答