reduce: Boolean miniziation for csQCA, mvQCA and fsQCA

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/QCA.R

Description

This is the core funtion for QCA (Qualitative Comparative Analysis). Given the outcome and conditions, it returns an object of class 'QCA', which contains all the possible configurations leading to the outcome. It can handle various kinds of QCA., namely csQCA, mvQCA, fsQCA and csTQCA.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
reduce(x,...)

## default method is an alias of truthTable method.

## S3 method for class 'truthTable'
reduce(x, explain = c("positive", "negative"),
       remainders = c("exclude","include"),
       contradictions = c("remainders","positive","negative"),
       dontcare = c("remainders", "positive", "negative"),
       cdontcare=c("remainders","positive","negative"),
       keepTruthTable = TRUE,all.sol = FALSE,...)

## S3 method for class 'data.frame'
reduce(x, outcome, conditions,
        explain = c("positive", "negative"),
        remainders = c("exclude", "include"),
        contradictions = c("remainders", "positive", "negative"),
        dontcare = c("remainders", "positive", "negative"),
        cdontcare=c("remainders","positive","negative"),
        preprocess = c("cs_truthTable", "fs_truthTable",
        "mv_truthTable"),
       keepTruthTable = TRUE,all.sol = FALSE, ...)

## S3 method for class 'formula'
reduce(x, data, explain = c("positive", "negative"),
      remainders = c("exclude", "include"),
      contradictions = c("remainders", "positive", "negative"),
      dontcare = c("remainders", "positive", "negative"),
      cdontcare=c("remainders","positive","negative"),
      preprocess = c("cs_truthTable", "fs_truthTable", "mv_truthTable"),
      keepTruthTable = TRUE,all.sol = FALSE, ...)

Arguments

x

a R object, it could be a truthTable, data frame or a formula

outcome

a character string to specify the outcome

data

a data frame, which is not optional.

conditions

a character vector to specify the conditions

explain

a character string specifying the cases to be explained. Must one of "positive" or "negative".

remainders

a character string specifying how to deal with outcome remainders. Must one of "exclude" or "include".

contradictions

a character string specifying how to deal with contraditory configurations. Must one of "remainders","positive" or "negative"

dontcare

a character string specifying how to deal with cases of dontcare outcome. Must one of "remainders", "positive", "negative"

cdontcare

a character string specifying how to deal with cases of dontcare conditions. Must one of "remainders", "positive", "negative"

preprocess

a character string specifying the function for preprocessing data, which turns raw data to a truthTable. Must one of cs_truthTable, fs_truthTable or mv_truthTable.

keepTruthTable

logical, when TRUE the returned object keeps the truthTable

all.sol

if FALSE, only solution from lpSolveAPI will be returned

...

other arguments passed to a function.

Details

Outcome is the variable to be explained by the conditions. Conditions is explanatory variables that may affect the outcome. It is not "independent variable" in statistical sense. Configuration is a combination of conditions relevant to a given outcome. Remainders are configurations that lack empirical instances. Conraditory configuration is a configuration whose outcome value is positive[1] for some cases and negative[0] for other cases.

It is good practices to attain the solutions for both positive outcome with and without remainders, and negative outcome with and without remainders. If a common necessary condition appears in both solutions for positive and negative outcome (without remainders), then such necessary condition is a trivial necessary condition(Caramani, 2009:62). It is not necessary to include trivial necessary condition in the final solutions.

It is good practices to generate and examine a truthTable, then use truthTable method of reduce to do the boolean minimization.

Value

An object of class "QCA". It is essentailly a list of 10 components.

solutions

a list of data.frame, each data frame represents one solution.

commonSolutions

A list of lenth nrow(solutionsIDX). For each row of solutionsIDX, if the primeImplicants index are the same for all solutions, then the index is return. Otherwise, it is NULL.

solutionsIDX

a matrix. Each column represents one solution. The number of the matrix is row index of primeImplicants.

primeImplicants

A matrix of prime implicants.

truthTable

a truthTable if keepTruthTable is TRUE, otherwise NULL.

explained

A data frame, representing the configuration of conditions for explained cases. Note it is not on basis of case but basis of configuration.

outcome

outcome name.

idExclude

integer vector. id of observed configurations that are excluded from minimization. The meaning of id is equivalent to the line number of a configuration discussed in Dusa (2007).

nlevels

a integer vector, the number of levels of each condition.

PIChart

a prime implicants charts, constructed according to primeImplicants and explained. It is a logic matrix with dimension of nrow(primeImplicants)x ncol(explained). It is TRUE if the corresponding primeImplicant covers the corresponding explained.

call

the matched call.

Note

With a 2.4 GHz and 4.0GB PC, it takes about about 0.5 minute for 12 conditions, 2 minutes for 13 conditions, 4.5 minutes for 14 conditions, and 9 minutes for 15 conditions. It may take a long time to get the solution when there are more conditions. You may use eqmcc if speed becomes an issue for reduce. The disparity is due to the fact that eqmcc eliminates redundant PIs before solving the PIChart (Thanks Adrian for pointting it out), but reduce does not. reduce is a bit greedy in terms of memory usage, for 15 conditions, it uses proximately 500 to 600 Mb memory in typical QCA study. I emphasis "typical" because the exact scenario also depends on the number of observed configurations.

Since version 0.0-3, reduce uses enhanced internal function ereduce1 (which uses enhanced internal function esubset). It has been tested and yields the same result (see tests directory for details).

Author(s)

Ronggui HUANG

References

Caramani, Daniele. 2009. "Introduction to the comparative method with Boolean algebra." Sage.

Benoit RiHoux and Charles Ragin (eds). 2009. Configuraional comparative Methods: qualitative comparative analysis (QCA) and related techniques. Sage.

Dusa, Adrian. 2007. Enhancing Quine-McCluskey, www.compasss.org/wpseries/Dusa2007b.pdf

Ragin, Charles. 2000. Fuzzy-Set Social Science. University Of Chicago Press.

Ragin, Charles. 1987. The Comparative Method. Moving beyond qualitative and quantitative strategies. University of California Press.

See Also

factorize, SA, CSA, constrReduce

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
## examples from "Configuraional comparative Methods"
## csQCA
conditions <- c("GNPCAP", "URBANIZA", "LITERACY", "INDLAB", "GOVSTAB")
reduce(Lipset_cs,"SURVIVAL",conditions,explain="positive",
       remainder="exclude",case="CASEID")
## or use formula
reduce(SURVIVAL~GNPCAP+URBANIZA+LITERACY+INDLAB+GOVSTAB,Lipset_cs,
       explain="positive",remainder="exclude",case="CASEID")
## Formula 1 in Rihoux and De Meur(2009:57)
reduce(Lipset_cs,"SURVIVAL",conditions,explain="negative",
       remainder="exclude", case="CASEID")
## Formula 3 in Rihoux and De Meur(2009:59)
ans1 <- reduce(Lipset_cs,"SURVIVAL",conditions,explain="positive",
               remainder="include", case="CASEID")
print(ans1) ## Formula 4 in Rihoux and De Meur(2009:60)
SA(ans1) ## 5 simplifying assumptions in p61
ans0 <-  reduce(Lipset_cs,"SURVIVAL",conditions,explain="negative",
              remainder="include",case="CASEID")
print(ans0) ## Formula 5 in Rihoux and De Meur(2009:61)
SA(ans0) ## 18 simplifying assumptions

## mvQCA
conditions <- c("GNPCAP", "URBANIZA", "LITERACY", "INDLAB")
reduce(Lipset_mv,"SURVIVAL", conditions, explain="positive",
       remainder="exclude", prep="mv_truthTable")
## formula 1 Cronqvist and Berg-Schlosser(2009:80)
ans1 <- reduce(Lipset_mv,"SURVIVAL",conditions,explain="positive",
               remainder="include", case="CASEID",prep="mv_truthTable")
print(ans1) ## formula 2 in Cronqvist and Berg-Schlosser(2009:81)
SA(ans1) ## 9 SAs (see end note 7)
reduce(Lipset_mv,"SURVIVAL",conditions,explain="negative",
      remainder="exclude", case="CASEID",prep="mv_truthTable")
## formula 3 in Cronqvist and Berg-Schlosser(2009:81)
ans0 <- reduce(Lipset_mv,"SURVIVAL",conditions,explain="negative",
              remainder="include",contrad="positive",
              case="CASEID",prep="mv_truthTable")
print(ans0) ## formula 4 in Cronqvist and Berg-Schlosser(2009:81)
SA(ans0) ## 7 SAs (see end note 9)

## fsQCA
conditions <- c("Developed.FZ","Urban.FZ","Literate.FZ",
                "Industrial.FZ", "Stable.FZ")
reduce(Lipset_fs,"Survived.FZ",conditions,explain="positive",
       remaind="exclude", prepro="fs",consistency=0.7)
## Formula 1 in Ragin (2009:112)
reduce(Lipset_fs,"Survived.FZ",conditions,explain="positive",
       remaind="include", prepro="fs",consistency=0.7)
## Formula 2 in Ragin (2009:114)
reduce(Lipset_fs,"Survived.FZ",conditions,explain="negative",
       remaind="exclude", prepro="fs",consistency=0.7)
## Formula 5 in Ragin (2009:115)
reduce(Lipset_fs,"Survived.FZ",conditions,explain="negative",
       remaind="include", prepro="fs",consistency=0.7)
## Formula 6 in Ragin (2009:117)

QCA3 documentation built on May 31, 2017, 2:14 a.m.