condTbl | R Documentation |
Given a solution object x
produced by cna
, msc(x)
extracts all minimally sufficient conditions, asf(x)
all atomic solution formulas, and csf(x, n.init)
builds approximately n.init
complex solution formulas. All solution attributes (details
) that are saved in x
are recovered as well. The three functions return a data frame with the additional class attribute condTbl
.
as.condTbl
reshapes the output produced by condition
in such a way as to make it identical to the output returned by msc
, asf
, and csf
.
condTbl
executes condition
and returns a concise summary table featuring consistencies and coverages.
msc(x, details = x$details) asf(x, details = x$details, warn_details = TRUE) csf(x, n.init = 1000, details = x$details, asfx = asf(x, details, warn_details = FALSE), inus.only = x$inus.only, minimalizeCsf = inus.only, acyclic.only = x$acyclic.only, cycle.type = x$cycle.type, verbose = FALSE) ## S3 method for class 'condTbl' print(x, n = 20, digits = 3, quote = FALSE, row.names = TRUE, ...) condTbl(...) as.condTbl(x, ...)
x |
Object of class “cna”. In |
details |
Either |
warn_details |
Logical; if |
n.init |
Integer capping the amount of initial asf combinations. Default at 1000. Serves to control the computational complexity of the csf building process. |
asfx |
Object of class “condTbl” produced by the |
inus.only |
Logical; if |
minimalizeCsf |
Logical; if |
acyclic.only |
Logical; if |
cycle.type |
Character string specifying what type of cycles to be detected: |
verbose |
Logical; if |
n |
Maximal number of msc, asf, or csf to be printed. |
digits |
Number of digits to print in consistency, coverage, exhaustiveness, faithfulness, and coherence scores. |
quote, row.names |
As in |
... |
All arguments in |
Depending on the processed data, the solutions (models) output by cna
are often ambiguous, to the effect that many atomic and complex solutions fit the data equally well. To facilitate the inspection of the cna
output, however, the latter standardly returns only 5 minimally sufficient conditions (msc), 5 atomic solution formulas (asf), and 5 complex solution formulas (csf) for each outcome. msc
can be used to extract all msc from an object x
of class “cna”, asf
to extract all asf, and csf
to build approximately n.init
csf from the asf stored in x
. All solution attributes (details
) that are saved in x
are recovered as well.
The outputs of msc
, asf
, and csf
can be further processed by the condition
function.
While msc
and asf
merely extract information stored in x
, csf
builds csf from the inventory of asf recovered at the end of the third stage of the cna
algorithm. That is, the csf
function implements the fourth stage of that algorithm. It proceeds in a stepwise manner as follows.
n.init
possible conjunctions featuring one asf of every outcome are built.
If inus.only = TRUE
or minimalizeCsf = TRUE
, the solutions resulting from step 1 are freed of structural redundancies (cf. Baumgartner and Falk 2019).
If inus.only = TRUE
, tautologous and contradictory solutions as well as solutions with partial structural redundancies and constant factors are eliminated.
[If inus.only = FALSE
and minimalizeCsf = TRUE
, only structural redundancies are eliminated, meaning only step 2, but not step 3, is executed.]
If acyclic.only = TRUE
, solutions with cyclic substructures are eliminated.
For those solutions that were modified in the previous steps, consistency and coverage are re-calculated and solutions that no longer reach con
or cov
are eliminated.
The remaining solutions are returned as csf, ordered by complexity and the product of consistency and coverage.
The argument digits
applies to the print
method. It determines how many digits of consistency, coverage, exhaustiveness, faithfulness, and coherence scores are printed. The default value is 3.
The function as.condTbl
takes a list of objects of class “cond” that are returned by the condition
function as input, and reshapes these objects in such a way as to make them identical to the output returned by msc
, asf
, and csf
.
condTbl(...)
is identical with as.condTbl(condition(...))
.
msc
, asf
, csf
, and as.condTbl
return objects of class “condTbl”, a data.frame
which features the following components:
outcome : | the outcomes |
condition : | the relevant conditions or solutions |
consistency : | the consistency scores |
coverage : | the coverage scores |
complexity : | the complexity scores |
inus : | whether the solutions have INUS form |
exhaustiveness : | the exhaustiveness scores |
faithfulness : | the faithfulness scores |
coherence : | the coherence scores |
redundant : | whether the csf contain redundant proper parts |
cyclic : | whether the csf contain cyclic substructures |
The latter five measures are optional and will be appended to the table according to the setting of the argument details
.
Falk, Christoph: development, testing
Baumgartner, Michael and Christoph Falk. 2019. “Boolean Difference-Making: A Modern Regularity Theory of Causation”. The British Journal for the Philosophy of Science.
doi:10.1093/bjps/axz047.
Lam, Wai Fung, and Elinor Ostrom. 2010. “Analyzing the Dynamic Complexity of Development Interventions: Lessons from an Irrigation Experiment in Nepal.” Policy Sciences 43 (2):1-25.
cna
, configTable
, condition
, minimalizeCsf
, d.irrigate
# Crisp-set data from Lam and Ostrom (2010) on the impact of development interventions # ------------------------------------------------------------------------------------ # CNA with causal ordering that corresponds to the ordering in Lam & Ostrom (2010); coverage # cut-off at 0.9 (consistency cut-off at 1). cna.irrigate <- cna(d.irrigate, ordering = "A, R, F, L, C < W", cov = .9, maxstep = c(4, 4, 12), details = TRUE) cna.irrigate # The previous function call yields a total of 12 complex solution formulas, only # 5 of which are returned in the default output. # Here is how to extract all 12 complex solution formulas along with all # solution attributes. csf(cna.irrigate) # With only the standard attributes plus exhaustiveness and faithfulness. csf(cna.irrigate, details = c("e", "f")) # Extract all atomic solution formulas. asf(cna.irrigate) # Extract all minimally sufficient conditions. msc(cna.irrigate) # capped at 20 rows print(msc(cna.irrigate), n = Inf) # prints all rows # Extract only the conditions (solutions). csf(cna.irrigate)$condition asf(cna.irrigate)$condition msc(cna.irrigate)$condition # A CNA of d.irrigate without outcome specification and ordering is even more # ambiguous. cna2.irrigate <- cna(d.irrigate, cov = .9, maxstep = c(4,4,12), details = TRUE) # To speed up the construction of complex solution formulas, first extract asf # and then pass these asf to csf. cna2.irrigate.asf <- asf(cna2.irrigate) csf(cna2.irrigate, asfx = cna2.irrigate.asf, details = FALSE) # Reduce the initial asf combinations. csf(cna2.irrigate, asfx = cna2.irrigate.asf, n.init = 50) # Print the first 20 csf. csf(cna2.irrigate, asfx = cna2.irrigate.asf, n.init = 50)[1:20, ] # Also extract exhaustiveness scores. csf(cna2.irrigate, asfx = cna2.irrigate.asf, n.init = 50, details = "e")[1:20, ] # Print details about the csf building process. csf(cna.irrigate, verbose = TRUE) # Return solution attributes with 5 digits. print(cna2.irrigate.asf, digits = 5) # Further examples # ---------------- # An example generating structural redundancies. target <- "(A*B + C <-> D)*(c + a <-> E)" dat1 <- selectCases(target) ana1 <- cna(dat1, maxstep = c(3, 4, 10)) # Run csf with elimination of structural redundancies. csf(ana1, verbose = TRUE) # Run csf without elimination of structural redundancies. csf(ana1, verbose = TRUE, inus.only = FALSE) # An example generating partial structural redundancies. dat2 <- data.frame(A = c(1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1), B = c(1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1), C = c(1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0), D = c(1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0), E = c(0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0), F = c(1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0)) ana2 <- cna(dat2, con = .8, cov = .8, maxstep = c(3, 4, 10)) # Run csf without elimination of partial structural redundancies. csf(ana2, inus.only = FALSE, verbose = TRUE) # Run csf with elimination of partial structural redundancies. csf(ana2, verbose = TRUE) # Only acyclic models. csf(ana2, verbose = TRUE, acyclic.only = TRUE) # Feed the outputs of msc, asf, and csf into the condition function to further inspect the # properties of minimally sufficient conditions and atomic and complex solution formulas. condition(msc(ana2)$condition, dat2) condition(asf(ana2)$condition, dat2) condition(csf(ana2)$condition, dat2) # Reshape the output of the condition function in such a way as to make it identical to the # output returned by msc, asf, and csf. as.condTbl(condition(msc(ana2)$condition, dat2)) as.condTbl(condition(asf(ana2)$condition, dat2)) as.condTbl(condition(csf(ana2)$condition, dat2)) condTbl(csf(ana2)$condition, dat2) # Same as preceding line
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.