# Remove everzthing that might be in your R working space from previous analyses rm(list = ls()) # Load the two packages relevant for doing set-theoretic analyses and the lattice package # NB: loading these packages will automatically load additional packages library(QCA) library(QCAGUI) library(SetMethods) library(shiny) #Set Working Directory (you have to do it on your computer) setwd("C:/Users/Kateřina/Dropbox/Doktorské/fsQCA/Binder 2015 replication") ## Load the data "REPDATA.csv" ## REP <- read.table("REPDATA.csv", row.names = 1, sep = ";", header = TRUE, dec = ",") # Check how the data look like head(REP) #Perform the ANALYSIS OF NECESSITY for the presence of the outcome STRONG. Remember to look for high consistency. pof(REP[, 1:5], REP$STRONG, relation="nec") # ANALYSIS OF SUFFICIENCY # Create a truth table. We can see that the truthTable command used for these purposes uses several # arguments specified in brackets. # outcome: specifies the outcome set; # conditions: represents a vector of the conditions sets; # incl.cut1: indicates the threshold for consistency of sufficiency; # show.cases: prints the cases names; # complete: a logical argument which when set to TRUE prints the complete truth table; # sort.by: sorts the truth table by inclusion score and/or number of cases; # For learning more about the truthTable command you can always ask R for help using: ?truthTable TT_whole <- truthTable(REP, outcome = "STRONG", conditions = colnames(REP[,1:5]), incl.cut1 = 0.9, show.cases = TRUE, complete = TRUE, PRI=TRUE, sort.by = c("incl", "n")) # View the truth table TT_whole # Solve the sufficiency formula using the truthtable you created in the previous step: sol_cons <- eqmcc(TT_whole, show.cases = TRUE, details = TRUE) # View the conservative solution: sol_cons # Solve the sufficiency formula for most parsimonious solution: sol_pars <- eqmcc (TT_whole, show.cases = TRUE, details = TRUE, include = "?") # View the parsimonious solution: sol_pars