data(CoD)
# Examples from Chapter 7
### table 6.2 in p77
cond <- c("econdev","eduhi","ethlihom","close","demex","nocom","parlia","efpahi","decent")
round(apply(CoD[, cond], 2, FUN=function(x) consistency(x,CoD$cod,'great')),3)
round(apply(CoD[, cond], 2, FUN=function(x) consistency(1-x,CoD$cod,'great')),3)
round(apply(CoD[, cond], 2, FUN=function(x) consistency(x,1-CoD$cod,'great')),3)
round(apply(CoD[, cond], 2, FUN=function(x)
consistency(1-x,1-CoD$cod,'great')),3)
round(apply(CoD[,c("econdev","demex")], 2, FUN=function(x) coverage(1-x,1-CoD$cod,'great')),3)
round(consistency(apply(1-CoD[,c("econdev","demex")],1,min),1-CoD$cod,'great'),3)
round(coverage(apply(1-CoD[,c("econdev","demex")],1,min),1-CoD$cod,'great'),3)
## QCA of remote conditions
reduce(CoD,'cod',c('econdev','ethlihom','close','demex','nocom'),'positive','include',
case='label',pre='fs_truthTable',keep=FALSE)
## consitency of remote conditions as sufficent condition (table 6.4 in p82)
round(apply(CoD[,c("econdev","ethlihom","nocom")], 2,
FUN=function(x) consistency(x,CoD$cod,'less')),3)
round(apply(CoD[,c("econdev","ethlihom","nocom")], 2,
FUN=function(x) coverage(x,CoD$cod,'less')),3)
round(consistency(apply(CoD[,c("econdev","ethlihom","nocom")],1,max),CoD$cod),3)
round(coverage(apply(CoD[,c("econdev","ethlihom","nocom")],1,max),CoD$cod),3)
## table 6.4 in page 82
fs=fs_truthTable(CoD,'cod',c('econdev','eduhi','ethlihom','close','demex','nocom'),case='label')
fs <- sort(fs,,"Consistency")
tb6.4 <- reduce(fs,remainder='include')
## table 6.6 in page 86
reduce(CoD,'cod', cond=c('parlia','efpahi','decent'),'positive','include',
case='label',pre='fs_truthTable')
reduce(CoD,'cod',c('econdev','ethlihom','nocom','parlia','efpahi','decent'),'positive','include',
case='label',pre='fs_truthTable')
## table 6.7 in pp87-88
fs_truthTable(CoD,'cod',c('econdev','ethlihom','nocom','parlia','efpahi','decent'),case='label')
Run the code above in your browser using DataLab