#Load QCA R Package; Read and Organize the Data:
library('QCA')
## Loading required package: admisc
##
## To cite package QCA in publications, please use:
## Dusa, Adrian (2019) QCA with R. A Comprehensive Resource.
## Springer International Publishing.
##
## To run the graphical user interface, use: runGUI()
data<-read.csv("QCA_grand_data - updated.csv")
#Change column names:
colnames(data)[colnames(data) == "ï..Country"] <- "cases"
colnames(data)[colnames(data) == "Sailency"] <- "S"
colnames(data)[colnames(data) == "Sailency.Pattern"] <- "SP"
colnames(data)[colnames(data) == "Technical.Staff"] <- "TechS"
colnames(data)[colnames(data) == "Self.Reporting.on.Resources"] <- "R"
colnames(data)[colnames(data) == "Budget.Based.on.Fines"] <- "BBOF"
colnames(data)[colnames(data) == "Inclusiveness"] <- "INC"
colnames(data)[colnames(data) == "Hierarchy"] <- "HIE"
colnames(data)[colnames(data) == "Tendency.to.Investigate"] <- "INV"
colnames(data)[colnames(data) == "Tendency.to.Fine"] <- "FINE"
#Calibrate to fuzzy set:
#Calibrate to fuzzy-set issue saliency:
data$S <- calibrate(data$S, thresholds = "e=10, c=52, i=200")
#Calibrate to fuzzy-set TechStaff precentage out of total staff:
#data$TechS <- calibrate(data$TechS, thresholds = "e=3, c=5.5, i=8")
data$TechS <- calibrate(data$TechS, thresholds = "e=2, c=6, i=12")
#Calibrate to fuzzy-set the ordinal variable - inclusiveness:
#data$INC <- calibrate(data$INC, method = "TFR")
data$INC <- calibrate(data$INC, thresholds = "e=0, c=2, i=4")
#Calibrate to fuzzy-set the ordinal variable - hierarchy:
#data$HIE <- calibrate(data$HIE, method = "TFR")
data$HIE <- calibrate(data$HIE, thresholds = "e=0, c=2, i=4")
INC_TT <- truthTable(data, outcome = "INC", conditions = "S,TechS,R,BBOF", show.cases = TRUE, complete = TRUE, incl.cut = c(0.8,0.6))
minimize(INC_TT, details = TRUE)
##
## M1: ~S*~TechS*~R + ~TechS*~R*~BBOF + S*TechS*~R*BBOF + S*TechS*R*~BBOF -> INC
##
## inclS PRI covS covU cases
## ----------------------------------------------------------
## 1 ~S*~TechS*~R 0.889 0.826 0.232 0.055 2,13; 14
## 2 ~TechS*~R*~BBOF 0.951 0.936 0.263 0.096 2,13; 5,12
## 3 S*TechS*~R*BBOF 0.839 0.000 0.053 0.042 8
## 4 S*TechS*R*~BBOF 0.900 0.866 0.180 0.180 7,17
## ----------------------------------------------------------
## M1 0.902 0.858 0.550
minimize(INC_TT, details = TRUE, include = "?")
##
## M1: S*TechS + ~TechS*~R -> INC
##
## inclS PRI covS covU cases
## --------------------------------------------------------
## 1 S*TechS 0.907 0.824 0.293 0.190 8; 7,17
## 2 ~TechS*~R 0.901 0.859 0.379 0.276 2,13; 14; 5,12
## --------------------------------------------------------
## M1 0.888 0.842 0.569
minimize(INC_TT, details = TRUE, include = "?")$SA
## $M1
## S TechS R BBOF
## 10 1 0 0 1
## 13 1 1 0 0
## 16 1 1 1 1
INC_TT <- truthTable(data, outcome = "~INC", conditions = "S,TechS,R,BBOF", show.cases = TRUE, complete = TRUE, incl.cut = c(0.8,0.6))
minimize(INC_TT, details = TRUE)
##
## M1: TechS*~R*BBOF -> ~INC
##
## inclS PRI covS covU cases
## ---------------------------------------------------
## 1 TechS*~R*BBOF 0.907 0.783 0.228 - 3; 8
## ---------------------------------------------------
## M1 0.907 0.783 0.228
minimize(INC_TT, details = TRUE, include = "?")
##
## M1: TechS*~R -> ~INC
## M2: TechS*BBOF -> ~INC
##
## -------------------
## inclS PRI covS covU (M1) (M2) cases
## -------------------------------------------------------------
## 1 TechS*~R 0.872 0.627 0.341 0.114 - 3; 8
## 2 TechS*BBOF 0.907 0.783 0.228 0.000 - 3; 8
## -------------------------------------------------------------
## M1 0.872 0.627 0.341
## M2 0.907 0.783 0.228
minimize(INC_TT, details = TRUE, include = "?")$SA
## $M1
## S TechS R BBOF
## 5 0 1 0 0
## 13 1 1 0 0
##
## $M2
## S TechS R BBOF
## 8 0 1 1 1
## 16 1 1 1 1
HIE_TT <- truthTable(data, outcome = "HIE", conditions = "S,TechS,R,BBOF", show.cases = TRUE, complete = TRUE, incl.cut = c(0.8,0.6))
minimize(HIE_TT, details = TRUE)
##
## M1: S*~TechS*R*~BBOF + ~S*~TechS*~R*BBOF -> HIE
##
## inclS PRI covS covU cases
## -------------------------------------------------------
## 1 S*~TechS*R*~BBOF 0.810 0.497 0.181 0.181 1,6
## 2 ~S*~TechS*~R*BBOF 0.942 0.878 0.109 0.109 14
## -------------------------------------------------------
## M1 0.855 0.647 0.289
minimize(HIE_TT, details = TRUE, include = "?")
##
## M1: ~TechS*BBOF + S*~TechS*R -> HIE
##
## inclS PRI covS covU cases
## -------------------------------------------------
## 1 ~TechS*BBOF 0.774 0.619 0.158 0.158 14
## 2 S*~TechS*R 0.810 0.497 0.181 0.181 1,6
## -------------------------------------------------
## M1 0.793 0.569 0.338
minimize(HIE_TT, details = TRUE, include = "?")$SA
## $M1
## S TechS R BBOF
## 4 0 0 1 1
## 10 1 0 0 1
## 12 1 0 1 1
HIE_TT <- truthTable(data, outcome = "~HIE", conditions = "S,SP,BBOF", show.cases = TRUE, complete = TRUE, incl.cut = c(0.8,0.6))
minimize(HIE_TT, details = TRUE)
##
## M1: SP*~BBOF + S*~SP*BBOF -> ~HIE
##
## inclS PRI covS covU cases
## -------------------------------------------------------
## 1 SP*~BBOF 0.715 0.602 0.416 0.416 4; 5,6,12,17
## 2 S*~SP*BBOF 0.826 0.771 0.103 0.103 8
## -------------------------------------------------------
## M1 0.735 0.633 0.519
minimize(HIE_TT, details = TRUE, include = "?")
##
## M1: S*BBOF + SP*~BBOF -> ~HIE
##
## inclS PRI covS covU cases
## -----------------------------------------------------
## 1 S*BBOF 0.724 0.605 0.125 0.125 8
## 2 SP*~BBOF 0.715 0.602 0.416 0.416 4; 5,6,12,17
## -----------------------------------------------------
## M1 0.717 0.603 0.541
minimize(HIE_TT, details = TRUE, include = "?")$SA
## $M1
## S SP BBOF
## 8 1 1 1
data_wout_NAs <- data[-c(9, 10, 17),]
#Make all three last columns numeric:
data_wout_NAs$INV <- as.numeric(data_wout_NAs$INV)
data_wout_NAs$FINE <- as.numeric(data_wout_NAs$FINE)
data_wout_NAs$DVG <- as.numeric(data_wout_NAs$DVG)
#Calibrate tendency to investige and tendency to fine:
data_wout_NAs$INV <- calibrate(data_wout_NAs$INV, thresholds = "e=10, c=50, i=75")
data_wout_NAs$FINE <- calibrate(data_wout_NAs$FINE, thresholds = "e=10, c=50, i=75")
#Preparing the "Divergency" Column:
data_wout_NAs$DVG_calibrated <- abs(data_wout_NAs$INC - data_wout_NAs$INV) + abs(data_wout_NAs$HIE - data_wout_NAs$FINE)
data_wout_NAs$DVG_calibrated <- calibrate(data_wout_NAs$DVG_calibrated, type = "crisp", thresholds = 1)
INV_TT <- truthTable(data_wout_NAs, outcome = "INV", conditions = "S,TechS,R,BBOF", show.cases = TRUE, complete = TRUE, incl.cut = c(0.8,0.6))
minimize(INV_TT, details = TRUE)
##
## M1: ~S*~R*BBOF + TechS*~R*BBOF -> INV
##
## inclS PRI covS covU cases
## ---------------------------------------------------
## 1 ~S*~R*BBOF 1.000 1.000 0.276 0.154 14; 3
## 2 TechS*~R*BBOF 1.000 1.000 0.235 0.113 3; 8
## ---------------------------------------------------
## M1 1.000 1.000 0.389
minimize(INV_TT, details = TRUE, include = "?")
##
## M1: BBOF -> INV
##
## inclS PRI covS covU cases
## ---------------------------------------------
## 1 BBOF 0.900 0.889 0.491 - 14; 3; 8
## ---------------------------------------------
## M1 0.900 0.889 0.491
minimize(INV_TT, details = TRUE, include = "?")$SA
## $M1
## S TechS R BBOF
## 4 0 0 1 1
## 8 0 1 1 1
## 10 1 0 0 1
## 12 1 0 1 1
## 16 1 1 1 1
INV_TT <- truthTable(data_wout_NAs, outcome = "~INV", conditions = "S,TechS,R,BBOF", show.cases = TRUE, complete = TRUE, incl.cut = c(0.8,0.6))
minimize(INV_TT, details = TRUE)
##
## M1: S*~TechS*~BBOF + ~TechS*~R*~BBOF -> ~INV
##
## inclS PRI covS covU cases
## ----------------------------------------------------------
## 1 S*~TechS*~BBOF 0.988 0.986 0.427 0.207 5,12; 1,6
## 2 ~TechS*~R*~BBOF 0.995 0.994 0.383 0.163 2,13; 5,12
## ----------------------------------------------------------
## M1 0.988 0.986 0.590
minimize(INV_TT, details = TRUE, include = "?")
##
## M1: S*~TechS + ~R*~BBOF -> ~INV
##
## inclS PRI covS covU cases
## ---------------------------------------------------
## 1 S*~TechS 0.866 0.830 0.462 0.242 5,12; 1,6
## 2 ~R*~BBOF 0.954 0.951 0.448 0.229 2,13; 5,12
## ---------------------------------------------------
## M1 0.881 0.861 0.691
minimize(INV_TT, details = TRUE, include = "?")$SA
## $M1
## S TechS R BBOF
## 5 0 1 0 0
## 10 1 0 0 1
## 12 1 0 1 1
## 13 1 1 0 0
FINE_TT <- truthTable(data_wout_NAs, outcome = "FINE", conditions = "S,TechS,R,BBOF", show.cases = TRUE, complete = TRUE, incl.cut = c(0.8,0.6))
minimize(FINE_TT, details = TRUE)
##
## M1: ~S*~R*BBOF + TechS*~R*BBOF -> FINE
##
## inclS PRI covS covU cases
## ---------------------------------------------------
## 1 ~S*~R*BBOF 0.907 0.862 0.288 0.148 14; 3
## 2 TechS*~R*BBOF 0.928 0.872 0.251 0.111 3; 8
## ---------------------------------------------------
## M1 0.890 0.800 0.399
FINE_TT <- truthTable(data_wout_NAs, outcome = "~FINE", conditions = "S,TechS,R,BBOF", show.cases = TRUE, complete = TRUE, incl.cut = c(0.8,0.6))
minimize(FINE_TT, details = TRUE)
##
## M1: ~S*~TechS*~BBOF + S*R*~BBOF -> ~FINE
##
## inclS PRI covS covU cases
## ----------------------------------------------------------------
## 1 ~S*~TechS*~BBOF 0.868 0.828 0.572 0.486 2,13; 4,11,15,16
## 2 S*R*~BBOF 0.887 0.858 0.272 0.187 1,6; 7
## ----------------------------------------------------------------
## M1 0.862 0.824 0.758
DVG_TT <- truthTable(data_wout_NAs, outcome = "DVG_calibrated", conditions = "S,TechS,R,BBOF", show.cases = TRUE, complete = TRUE, incl.cut = c(0.8,0.6))
minimize(DVG_TT, details = TRUE)
##
## M1: ~TechS*~R*~BBOF + ~S*TechS*~R*BBOF -> DVG_calibrated
##
## inclS PRI covS covU cases
## -----------------------------------------------------------
## 1 ~TechS*~R*~BBOF 1.000 1.000 0.546 0.546 2,13; 5,12
## 2 ~S*TechS*~R*BBOF 0.925 0.925 0.103 0.103 3
## -----------------------------------------------------------
## M1 0.987 0.987 0.650
minimize(DVG_TT, details = TRUE, include = "?")
##
## M1: ~S*TechS + ~R*~BBOF -> DVG_calibrated
##
## inclS PRI covS covU cases
## ---------------------------------------------------
## 1 ~S*TechS 0.731 0.731 0.228 0.107 3
## 2 ~R*~BBOF 1.000 1.000 0.667 0.546 2,13; 5,12
## ---------------------------------------------------
## M1 0.902 0.902 0.774
minimize(DVG_TT, details = TRUE, include = "?")$SA
## $M1
## S TechS R BBOF
## 5 0 1 0 0
## 7 0 1 1 0
## 8 0 1 1 1
## 13 1 1 0 0