###########################################
## ##
## Analyzing multilevel data with QCA: ##
## Yet another straightforward procedure ##
## ##
## Alrik Thiem ##
## ##
## Replication File, 25/11/2014 ##
## ##
###########################################
# 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(QCA)
# 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 <- eqmcc(tt.com.pos, details = TRUE, show.cases = TRUE)
sol.com.pos
# conservative solution with negative outcome
sol.com.neg <- eqmcc(tt.com.neg, 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 <- eqmcc(tt.par.pos, include = "?", 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 <- eqmcc(tt.par.neg, include = "?", 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 <- eqmcc(tt.13, include = "?", details = TRUE, show.cases = TRUE)
sol.13
# PI chart
sol.13$PIchart