#Replication code for book (needs tidy -pages my need update) #load required packages library(QCA); library(SetMethods) ############# # Chapter 6 Necessary Conditions for Democratic Rerform #load table for analysing deep democracy A (portion of table 6-2) wampa<-read.csv("Wamp2.csv", row.names = 1) wampa # Produce results for table 6-3 # Analyse necessary conditions for outcome 'deepened democracy A' superSubset (wampa, outcome = "deepda", incl.cut = 0, cov.cut = 0) # Analse Necessary conditions for outcome '~deepened democracy A' superSubset (wampa, outcome = "~deepda", incl.cut = 0, cov.cut = 0) #load table for analysing deep democracy B discussed on p.182-183 wampb<-read.csv("wampb.csv", row.names = 1) wampb # Analyse necessary conditions for outcome 'deepened democracy B' superSubset (wampb, outcome = "deepdb", incl.cut = 0, cov.cut = 0) # Analse Necessary conditions for outcome '~deepened democracy B' superSubset (wampb, outcome = "~deepdb", incl.cut = 0, cov.cut = 0) # produce figure 6-1 Necesstity of mayoral support for deepened democracy B xy.plot("ms", "deepdb", data = wampb, labs = rownames(wampb), necessity = TRUE, jitter = TRUE, main = "Necessity of mayoral support for deepened democracy B", xlab = "mayoral support", ylab = "deepened democracy B") #load table for analysing deep democracy C discussed on p.183-185 and produced in table 6-4 wampc<-read.csv("wampc.csv", row.names = 1) wampc # Analyse necessary conditions for outcome 'deepened democracy C' superSubset (wampc, outcome = "deepdc", incl.cut = 0, cov.cut = 0) # Analse Necessary conditions for outcome '~deepened democracy C' superSubset (wampc, outcome = "~deepdc", incl.cut = 0, cov.cut = 0) # Load data for extended analysis with Wampler's 5 causal conditions (Table 6-5) wdata<-read.csv("WExpdata.csv", row.names = 1) wdata # Produce table 6 6 Super-subset relations for single necessary conditions (5 condition analysis) # Analyse necessary conditions for outcome 'Deepened democracy' superSubset (wdata, outcome = "deepd", incl.cut = 0, cov.cut = 0) # Analyse necessary conditions for outcome '~deepened democracy' superSubset (wdata, outcome = "~deepd", incl.cut = 0, cov.cut = 0) # produce figure 6-2 x-y plot of set membership in deepened democracy and civil society support for contentious and cooperative politics xy.plot("ccp", "deepd", data = wdata, labs = rownames(wdata), necessity = TRUE, jitter = TRUE, main = "Is contentious politics necessary for deepened democracy?", xlab = "Citizens using contentious and cooperative politics", ylab = "Deepened democracy") # produce table 6-7 showing Boolean sum experessions for necessity for deepended democracy SUIN_wdata <- superSubset(wdata,outcome = "deepd", conditions = c("ms", "ccp", "ple", "fbs", "rep"), incl.cut = 0.95, cov.cut = 0.5) SUIN_wdata # Load data for analysis of 31 worldwide conditions t31<-read.csv("t31.csv", row.names = 1) t31 # analyse necessary conditions for outcome citizen control of PB to produce table 6-8 SUIN_t31 <- superSubset(t31,outcome = "ccpb", conditions = c("pl", "bsp", "csd", "fbs"), incl.cut = 0.9, cov.cut = 0.5) SUIN_t31 # Produce Figure 6 3 Necessity of Participatory Leadership for Citizen Control xy.plot("pl", "ccpb", data = t31, labs = rownames(t31), necessity = TRUE, jitter = TRUE, main = "Necessity of Participatory Leadership for Citizen Control", xlab = "Participatory Leadership", ylab = "Citizen Control") # Produce Figure 6 4 Fuzzy X-Y plot for Necessity of Citizen control: Autonomous Civil Society Demand xy.plot("csd", "ccpb", data = t31, labs = rownames(t31), necessity = TRUE, jitter = TRUE, main = "Necessity of Aut. Civil Society D", xlab = "Autonomous Civil Society Demands", ylab = "Citizen Control") # produce data for table 6-9 Fuzzy X-Y plot for Necessity of Citizen control: Autonomous Civil Society Demand in two parts # Analyse single necessary conditions for outcome 'citizen control' superSubset (t31, outcome = "~ccpb", incl.cut = 0, cov.cut = 0) # # analyse necessary conditions for outcome citizen control of PB to produce table 6-8 SUIN_nt31 <- superSubset(t31,outcome = "~ccpb", conditions = c("pl", "bsp", "csd", "fbs"), incl.cut = 0.95, cov.cut = 0.5) SUIN_nt31 ####### # Chapter 7 Success: How citizen control of politics is achieved # Produce analysis for Table 7 2 Analysis of sufficient conditions for deepened democracy across 10 cases in several steps # Create a truth table (Table 7 3 Truth table for outcome 'Deepened democracy A') TT_wampa <- truthTable(wampa, outcome = "deepda", neg.out = FALSE, conditions = c("ms","cwcp"), incl.cut = 0.8, show.cases = TRUE, complete = TRUE, sort.by = c("incl", "n")) TT_wampa # produce solution for row 1 of table 7-2 # Conservative solution sol_deepda <- minimize(TT_wampa, show.cases = TRUE, row.dom=TRUE, details = TRUE) sol_deepda # Create a truth table for deepdB TT_wampb <- truthTable(wampb, outcome = "deepdb", neg.out = FALSE, conditions = c("ms","cwcp"), incl.cut = 0.8, show.cases = TRUE, complete = TRUE, sort.by = c("incl", "n")) TT_wampb # produce solution for row 2 of table 7-2 # Conservative solution sol_deepdb <- minimize(TT_wampb, show.cases = TRUE, row.dom=TRUE, details = TRUE) sol_deepdb # here we can also produce the parsimonious solution discussed briefly on p. 221-222 sol_deepdbp <- minimize(TT_wampb, show.cases = TRUE, row.dom=TRUE, details = TRUE, include = "?") sol_deepdbp # Create a truth table for deepdc TT_wampc <- truthTable(wampc, outcome = "deepdc", neg.out = FALSE, conditions = c("ms","cwcp"), incl.cut = 0.8, show.cases = TRUE, complete = TRUE, sort.by = c("incl", "n")) TT_wampc # produce solution for row 3 of table 7-2 (you can note the solution is not explained by the TT but for completeness...) # Conservative solution sol_deepdc <- minimize(TT_wampc, show.cases = TRUE, row.dom=TRUE, details = TRUE) sol_deepdc # produceTable 7 4 Truth table for outcome 'Deepened democracy A' with alternative coding #load alternative coding wampa2<-read.csv("wampa2.csv", row.names = 1) wampa2 #create Truth Table (7-4) TT_wampa2 <- truthTable(wampa2, outcome = "deepda", neg.out = FALSE, conditions = c("ms","cwcp"), incl.cut = 0.8, show.cases = TRUE, complete = TRUE, sort.by = c("incl", "n")) TT_wampa2 # Extended Wampler Analsyis: Produce table 7-5 Truth Table - sufficient conditions for deepened democracy (5 conditions) # note outcome set as ? for some rows in book for explanatory purposes - inclusion cut off set at 0.9 for first analysis discussed on p.226 TT_wdata <- truthTable(wdata, outcome = "deepd", neg.out = FALSE, conditions = c("ms","ccp","ple","rep", "fbs"), incl.cut = 0.9, show.cases = TRUE, complete = TRUE, sort.by = c("incl", "n")) TT_wdata # produce minimal solutions for inclusion cut off of 0.9 discussed on p. 226 # Conservative solution, sol_wdata9 <- minimize(TT_wdata, show.cases = TRUE, row.dom=TRUE, details = TRUE) sol_wdata9 # Most parsimonious solution sol_wdata9p <- minimize(TT_wdata, details = TRUE, row.dom = TRUE, include = "?") sol_wdata9p # Produce Figure 7 1 Sufficiency of row 2 # note that to reproduce the exact row and figure labels presented in the book I reproduced a data column for the row, imported it and used XY plot command pimplot(data=wdata, results=sol_wdata9, ttrows=c("24"), outcome= "deepd", all_labels = TRUE, jitter = TRUE) # Produce Truth table with a inclusion thershold of 0.899 TT_wdata89 <- truthTable(wdata, outcome = "deepd", neg.out = FALSE, conditions = c("ms","ccp","ple","rep", "fbs"), incl.cut = 0.89, show.cases = TRUE, complete = TRUE, sort.by = c("incl", "n")) TT_wdata89 # produce minimal solutions for inclusion cut off of 0.899 # Conservative solution, sol_wdata89 <- minimize(TT_wdata89, show.cases = TRUE, row.dom=TRUE, details = TRUE) sol_wdata89 # Most parsimonious solution sol_wdata89p <- minimize(TT_wdata89, details = TRUE, row.dom = TRUE, include = "?") sol_wdata89p # Produce intermediate solution reported in table 7-6 # intermediate solution 1 sol_wdata89i <- minimize(TT_wdata89, details = TRUE, include = "?",row.dom = TRUE, dir.exp = "~ms") sol_wdata89i #factorise factorize(sol_wdata89i) # Large-N comparison: ProduceTable 7 7 Truth table for citizen control of PB for 31 cases # note outcome set as ? for some rows in book for explanatory purposes - inclusion cut off set at 0.95 TT_t31a <- truthTable(t31, outcome = "ccpb", neg.out = FALSE, conditions = c("pl","csd","bsp", "fbs"), incl.cut = 0.95, show.cases = TRUE, complete = TRUE, sort.by = c("incl", "n")) TT_t31a # produce solution including 4 rows with true logical contradictions: Table 7 8 Sufficient conditions for citizen control across 31 cases # First produce a truth table with inclusion cut off of 0.82 TT_t31 <- truthTable(t31, outcome = "ccpb", neg.out = FALSE, conditions = c("pl","csd","bsp", "fbs"), incl.cut = 0.82, show.cases = TRUE, complete = TRUE, sort.by = c("incl", "n")) TT_t31 # use enhance standard analysis tool to recode row 7 as absence of outcome TT_t31 <- esa(TT_t31, contrad_rows = "7") TT_t31 # produce minimal solutions # Conservative solution sol_t31<- minimize(TT_t31, show.cases = TRUE, row.dom=TRUE, details = TRUE) sol_t31 # Most parsimonious solution sol_t31 <- minimize(TT_t31, details = TRUE, row.dom = TRUE, include = "?") sol_t31 #factorise factorize(sol_t31) #produce alternative and more restrictive solution discussed on p.239 # Conservative solution sol_t31a<- minimize(TT_t31a, show.cases = TRUE, row.dom=TRUE, details = TRUE) sol_t31a # Most parsimonious solution sol_t31a <- minimize(TT_t31a, details = TRUE, row.dom = TRUE, include = "?") sol_t31a ######## # Chapter 8 How citizen control of politics is negated and the puzzles that remain # Produce anlysis for Table 8 1 Analysis of sufficient conditions for the negation of deepened democracy across 10 cases in several steps # Create a truth table for outcome '~deepened democracy A' TT_wampna <- truthTable(wampa, outcome = "deepda", neg.out = TRUE, conditions = c("ms","cwcp"), incl.cut = 0.8, show.cases = TRUE, complete = TRUE, sort.by = c("incl", "n")) TT_wampna # produce solution for row 1 of table 8-1 # Conservative solution sol_deepdna <- minimize(TT_wampna, show.cases = TRUE, row.dom=TRUE, details = TRUE) sol_deepdna # Create a truth table for '~deepdB' TT_wampnb <- truthTable(wampb, outcome = "deepdb", neg.out = TRUE, conditions = c("ms","cwcp"), incl.cut = 0.8, show.cases = TRUE, complete = TRUE, sort.by = c("incl", "n")) TT_wampnb # produce solution for row 2 of table 8-1 # Conservative solution sol_deepdnb <- minimize(TT_wampnb, show.cases = TRUE, row.dom=TRUE, details = TRUE) sol_deepdnb # Create Table 8 2 Truth table for outcome '~deepened democracy C' TT_wampnc <- truthTable(wampc, outcome = "deepdc", neg.out = TRUE, conditions = c("ms","cwcp"), incl.cut = 0.8, show.cases = TRUE, complete = TRUE, sort.by = c("incl", "n")) TT_wampnc # produce solution for row 3 of table 8-1 # Conservative solution sol_deepdnc <- minimize(TT_wampnc, show.cases = TRUE, row.dom=TRUE, details = TRUE) sol_deepdnc # Extended analysis: Produce Table 8 3 Truth table for outcome (5 conditions) TT_wdatan <- truthTable(wdata, outcome = "deepd", neg.out = TRUE, conditions = c("ms","ccp","ple","rep", "fbs"), incl.cut = 0.9, show.cases = TRUE, complete = TRUE, sort.by = c("incl", "n")) TT_wdatan # produce minimal solutions Table 8 4 Sufficient conditions for ~ deepened democracy (5 conditions) # Conservative solution, sol_wdatanc <- minimize(TT_wdatan, show.cases = TRUE, row.dom=TRUE, details = TRUE) sol_wdatanc # Most parsimonious solution sol_wdatanp <- minimize(TT_wdatan, details = TRUE, row.dom = TRUE, include = "?") sol_wdatanp # Produce intermediate solution reported in table 8-4 # intermediate solution sol_wdatani <- minimize(TT_wdatan, details = TRUE, include = "?",row.dom = TRUE, dir.exp = "ms,ccp,ple") sol_wdatani #factorise factorize(sol_wdatani) # Analysis of 31 cases: produce Table 8 5 Truth table for negation of citizen control of PB. TT_t31na <- truthTable(t31, outcome = "ccpb", neg.out = TRUE, conditions = c("pl","csd","bsp", "fbs"), incl.cut = 0.84, show.cases = TRUE, complete = TRUE, sort.by = c("incl", "n")) TT_t31na # produce sufficiency solution for inclusion threshold of 0.87 discussed on p.250 TT_t31n87 <- truthTable(t31, outcome = "ccpb", neg.out = TRUE, conditions = c("pl","csd","bsp", "fbs"), incl.cut = 0.87, show.cases = TRUE, complete = TRUE, sort.by = c("incl", "n")) TT_t31n87 # produce minimal solutions # Conservative solution sol_t31n87c<- minimize(TT_t31n87, show.cases = TRUE, row.dom=TRUE, details = TRUE) sol_t31n87c # Most parsimonious solution sol_t31n87p <- minimize(TT_t31n87, details = TRUE, row.dom = TRUE, include = "?") sol_t31n87p # Finally produce figure 8-1 to investigate cases with high levels of political leadership and low levels of citizen control xy.plot("pl", "~ccpb", data = t31, labs = rownames(t31), necessity = FALSE, jitter = TRUE, main = "Participatory Leadership*~Citizen Control", xlab = "Particpatory Leadership", ylab = "~Citizen Control")