Learn R Programming

QCA (version 1.0-5)

eqmcc: Boolean Minimization with Enhanced Quine-McCluskey Algorithm

Description

This function is the core function of the QCA package, which performs the reduction of canonical sums to minimal sums. It is called "eqmcc" because it is an 'e'nhancement of the classical Quine McCluskey minimization algorithm.

Usage

eqmcc(data, outcome = "", neg.out = FALSE, conditions = c(""), n.cut = 1,
      incl.cut1 = 1, incl.cut0 = 1, explain = "1", include = c(""), 
      all.sol = FALSE, omit = c(), direxp = c(), rowdom = TRUE, details = FALSE, 
      show.cases = FALSE, use.tilde = FALSE, use.letters = FALSE)

is.qca(x)

Arguments

data
A truth table object or a dataset of (binary or multi-value) crisp or fuzzy-set data.
outcome
The name of the outcome set.
neg.out
Logical, use negation of outcome set (ignored if mydata is a truth table object).
conditions
The names of the condition sets (if not specified, all sets in mydata but the outcome).
n.cut
The minimum number of cases with membership > 0.5 for an outcome value of "0", "1" or "C".
incl.cut1
The minimum sufficiency inclusion score for an outcome value of "1".
incl.cut0
The maximum sufficiency inclusion score for an outcome value of "0".
explain
The outcome value to be explained, either "1", "0" or "C".
include
The outcome value(s) of additional configurations to be included in the minimization.
all.sol
Derive all possible solutions, irrespective of the number of PIs.
omit
A vector or a matrix of configurations to be omitted from minimization.
direxp
A vector of directional expectations.
rowdom
Logical, apply row dominance principle to eliminate dominated PIs.
details
Logical, present details about solution.
show.cases
Logical, also print case names if details = TRUE.
use.tilde
Logical, use a tilde for set negation with binary-value set data.
use.letters
Logical, use letters instead of set names.
x
An object of class "qca".

Value

  • An invisible list with the following components:
  • ttThe truth table object.
  • excludedThe line numbers of the false configurations.
  • initialsThe initial fundamental products.
  • PIsThe prime implicants.
  • PIchartA list containing the PI chart(s).
  • solutionA list of solution(s).
  • SAThe simplifying assumptions.

Details

mydata can be a truth table object (an object of class "tt" returned by truthTable()) or a dataset of (binary or multi-value) crisp or fuzzy-set data. The dataset specifed as mydata has to have the following structure: values of 0 and 1 for binary-value crisp sets, values between 0 and 1 for fuzzy set data, and values beginning with 0 and increments of 1 for mutli-value crisp set data. "Don't care" values are indicated by a dash "-" or the placeholder "dc" or any negative integer. These values are ignored in the minimization. Sets which contain these values are excluded from the computation of parameters of fit.

If the argument conditions is not specified, all sets in the dataset of (binary or multi-value) crisp or fuzzy-set data but the outcome are included.

Configurations that contain fewer than n.cut cases with membership above 0.5 are coded as logical remainders ("?"). If the number of such cases is at least n.cut, configurations with an inclusion score of at least incl.cut1 are coded as true ("1"), configuration with an inclusion score below incl.cut1 but with at least incl.cut0 are coded as a contradiction ("C"), and configurations with an inclusion score below incl.cut0 are coded as false ("0"). If incl.cut0 is not specified, it is set equal to incl.cut1 and no contradictions can occur.

The argument explain specifies the outcome value to be explained. Note that explain = 0 is not the same as explaining the negation of the outcome, although the solution may be the same, particularly for crisp sets.

The argument include specifies the outcome values of those configurations which shall be included in addition to the configurations which are to be explained. Note that argument combinations such as explain = "1", include = "0" make no sense.

When rowdom = FALSE, the argument all.sol solves the PI chart by deriving all possible solutions, irrespective of the number of PIs (suggestion by Michael Baumgartner).

The argument omit can be used to omit any configuration from the minimization. If the omit argument is a vector, it should contain row numbers from the (complete) truth table. If it is a matrix, it should be of the same format as the truth table.

Directional expectations for filtering logical remainders are specified by the direxp argument. For binary-value crisp sets and fuzzy sets they should be given as a vector of the same length and in the same order of conditions as in conditions. A value of "1" indicates that the presence of the condition is expected to contribute to an outcome value of "1", "0" that the absence of the condition is expected to contribute to an outcome value of "1", and "-1" indicates no directional expectation regarding the set-theoretic relation between the configuration and the outcome set. In the case of multi-value crisp sets, directional expectations require the identification of the category name(s), separated by semicolons and all enclosed by double quotes. The provision of a category name indicates that the presence of this category is expected to contribute to an outcome value of "1". Implicitly, it is the absence of all other categories which is expected to contribute.

If alternative minimal sums exist, all of them are printed if the row dominance principle for PIs is not applied as specified in the logical argument rowdom. One inessential prime implicant $P1$ dominates another $P2$ if all fundamental products covered by $P2$ are also covered by $P1$ and both are not interchangeable. Inessential PIs are listed in brackets in the solution output and at the end of the PI part in the parameters-of-fit table when details = TRUE, together with their unique coverage scores under each individual minimal sum.

If the conditions are already named with single letters, the argument use.letters will have no effect.

References

A. Dusa. A Mathematical Approach to the Boolean Minimization Problem. Quality & Quantity, 44(1):99-113, 2010.

A. Dusa. Enhancing Quine-McCluskey. WP 2007-49, COMPASSS, 2007. URL: http://www.compasss.org/wpseries/Dusa2007b.pdf.

P. Emmenegger. Job Security Regulations in Western Democracies: A Fuzzy Set Analysis. European Journal of Political Research, 50(3):336-364, 2011.

C. Hartmann and J. Kemmerzell. Understanding Variations in Party Bans in Africa. Democratization, 17(4):642-665, 2010.

M. L. Krook. Women's Representation in Parliament: A Qualitative Comparative Analysis. Political Studies, 58(5):886-908, 2010.

C. C. Ragin. Redesigning Social Inquiry: Fuzzy Sets and Beyond. University of Chicago Press, Chicago, 2008.

C. C. Ragin and S. I. Strand. Using Qualitative Comparative Analysis to Study Causal Order: Comment on Caren and Panofsky (2005). Sociological Methods & Research, 36(4):431-441, 2008.

See Also

truthTable

Examples

Run this code
# csQCA using Krook (2010)
#-------------------------
data(Krook)
Krook

# explain true configurations, complex solution
eqmcc(Krook, outcome = "WNP")

# explain true configurations with negated outcome set, complex solution
eqmcc(Krook, outcome = "WNP", neg.out = TRUE)

# same result with false configurations (not always the case!)
eqmcc(Krook, outcome = "WNP", explain = "0")

# explain true configurations, parsimonious solution, 
# with solution details
eqmcc(Krook, outcome = "WNP", include = "?", details = TRUE)

# explain true configurations, parsimonious solution, 
# with solution details and without row dominance
KrookSP <- eqmcc(Krook, outcome = "WNP", include = "?", details = TRUE, 
  rowdom = FALSE)
KrookSP
  
# pass truth table object to eqmcc() and derive complex solution
KrookTT <- truthTable(Krook, outcome = "WNP")
KrookSC <- eqmcc(KrookTT)
KrookSC

# print fundamental products
KrookSC$initials

# fsQCA using Emmenegger (2011)
#------------------------------
data(Emme)
Emme

# explain true configurations with negated outcome set, parsimonious solution,
# with solution details
eqmcc(Emme, outcome = "JSR", neg.out = TRUE, include = "?", 
  details = TRUE)

# explain true configurations, intermediate solution, 
# with directional expectations and solution details
EmmeSI <- eqmcc(Emme, outcome = "JSR", incl.cut1 = 0.9, include = "?", 
  direxp = c(1,1,1,1,1,0), details = TRUE)
EmmeSI

# check PI chart for intermediate solution
EmmeSI$PIchart$i.sol

# check simplifying assumptions
EmmeSI$SA$S1

# check easy counterfactuals
EmmeSI$i.sol$C1P1$cntfs

# plot all PIs from intermediate solution
PIsc <- EmmeSI$pims$i.sol$C1P1
par(mfrow = c(2, 2))
for(i in 1:4){
 plot(PIsc[, i], Emme$JSR, pch = 19, ylab = "JSR",
  xlab = colnames(PIsc)[i], xlim = c(0, 1), ylim = c(0, 1),
  main = paste("PI", print(i)))
 abline(0, 1)
}

# mvQCA using Hartmann and Kemmerzell (2010)
#-------------------------------------------
data(HarKem)
HarKem

conds <- c("C", "F", "T", "V")

# explain true configurations, parsimonious solution, 
# with contradictions
HarKemSP <- eqmcc(HarKem, outcome = "PB", conditions = conds, 
  include = c("?", "C"), details = TRUE)
HarKemSP

# a Venn diagram of the solution;
# first extract PI membership scores
PIms <- HarKemSP$pims$p.sol

require(VennDiagram)
vennHarKemSuf <- venn.diagram(
 x = list(
 "PB" = which(HarKem$PB == 1),
 "C{0,1}" = which((PIms[,1] | PIms[,2]) == 1),
 "F{2}" = which(PIms[,3] == 1),
 "T{1,2}*V{0}" = which((PIms[,4] | PIms[,5]) == 1)),
 filename = NULL,
 cex = 2.5, cat.cex = 2, cat.pos = c(180, 180, 0, 0),
 cat.dist = c(0.4, 0.4, 0.12, 0.12),
 fill = gray(c(0.3, 0.5, 0.7, 0.9))
)
grid.draw(vennHarKemSuf)

# explain the contradictions
# N.B.: Only one contradiction, no minimization
eqmcc(HarKem, outcome = "PB", conditions = conds, incl.cut0 = 0.4, 
  explain = "C")

# explain true configurations, intermediate solution,
# with directional expectations:
# C{1}, F{1,2}, T{2}, V contribute to PB
HarKemSI <- eqmcc(HarKem, outcome = "PB", conditions = conds, 
  include = "?", direxp = c(1, "1;2", 2, 1))
HarKemSI

# deriving all possible solutions of the PI chart, not just minimal sum
HarKemALL <- eqmcc(HarKem, outcome = "PB", conditions = conds, 
  include = "?", all.sol = TRUE, rowdom = FALSE)
HarKemALL

# tQCA using Ragin and Strand (2008)
#-----------------------------------
data(RagStr)
RagStr

# explain true configurations, complex solution, with solution details and cases;
# auxiliary condition EBA is automatically excluded from parameters of fit
eqmcc(RagStr, outcome = "REC", details = TRUE, show.cases = TRUE)

Run the code above in your browser using DataLab