#############################################################################
# #
# Analyzing multilevel data with QCA: Yet another straightforward procedure #
# #
# Author: Alrik Thiem #
# Date : 25 November 2014 #
# #
# Note: This is an updated replication file (8 February 2016) in which #
# the QCApro package is used, not the QCA package as stated in the #
# original article #
# #
#############################################################################
# Notational changes:
# Context (C): B = 0; H = 1; C = 2
# Size of minority (S): S = 1; s = 0
# Wealth of minority (W): W = 1; w = 0
# Mobilization of minority (M): M = 1, m = 0
library(QCApro)
# replication
dat <- data.frame(
C = c(0,0,0,0,1,1,1,1,2,2,2,2),
S = c(1,1,0,0,0,0,0,0,1,1,0,0),
W = c(0,0,0,0,1,1,0,0,1,1,1,1),
M = c(1,1,0,0,1,1,0,0,1,1,0,0)
)
# truth table for conservative solution with positive outcome
tt.com.pos <- truthTable(dat, outcome = "M{1}", show.cases = TRUE)
tt.com.pos
# truth table for conservative solution with negative outcome
tt.com.neg <- truthTable(dat, outcome = "M{0}", show.cases = TRUE)
tt.com.neg
# conservative solution with positive outcome
sol.com.pos <- eQMC(tt.com.pos, sol.type = "cs", details = TRUE, show.cases = TRUE)
sol.com.pos
# conservative solution with negative outcome
sol.com.neg <- eQMC(tt.com.neg, sol.type = "cs", details = TRUE, show.cases = TRUE)
sol.com.neg
# truth table for parsimonious solution with positive outcome
tt.par.pos <- truthTable(dat, outcome = "M{1}", show.cases = TRUE, complete = TRUE)
tt.par.pos
# parsimonious solution with positive outcome
sol.par.pos <- eQMC(tt.par.pos, details = TRUE, show.cases = TRUE)
sol.par.pos
# simplifying assumptions
SA.pos <- sol.par.pos$SA$M1
SA.pos
# parsimonious solution with negative outcome
tt.par.neg <- truthTable(dat, outcome = "M{0}", show.cases = TRUE, complete = TRUE)
tt.par.neg
sol.par.neg <- eQMC(tt.par.neg, details = TRUE, show.cases = TRUE,
omit = SA.pos)
sol.par.neg
SA.neg <- sol.par.neg$SA$M1
SA.neg
# replication with consistency and coverage (including case 13, table 1)
dat13 <- data.frame(
C = c(0,0,0,0,1,1,1,1,2,2,2,2,2),
S = c(1,1,0,0,0,0,0,0,1,1,0,0,1),
W = c(0,0,0,0,1,1,0,0,1,1,1,1,1),
M = c(1,1,0,0,1,1,0,0,1,1,0,0,0)
)
# truth table for parsimonious solution with positive outcome
tt.13 <- truthTable(dat13, outcome = "M{1}", show.cases = TRUE, complete = TRUE)
tt.13
# parsimonious solution with positive outcome
# note: presence of ambiguities (two models)
sol.13 <- eQMC(tt.13, details = TRUE, show.cases = TRUE)
sol.13
# PI chart
sol.13$PIchart