Learn R Programming

cna (version 2.2.3)

condTbl: Extract conditions and solutions from an object of class “cna”

Description

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) extracts at least n 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.

Usage

msc(x, details = x$details)
asf(x, details = x$details, warn_details = TRUE)
csf(x, n = 20, tt = x$truthTab, details = x$details, 
    asfx = asf(x, details, warn_details = FALSE))

# S3 method for condTbl print(x, digits = 3, quote = FALSE, row.names = TRUE, ...)

condTbl(...) as.condTbl(x, ...)

Arguments

x

Object of class “cna”. In as.condTbl, x is a list of evaluated conditions as returned by condition.

details

Either TRUE/FALSE or a character vector specifying which solution attributes to print (see cna). Note that msc and asf can only display attributes that are saved in x, i.e. those that have been requested in the details argument within the call of cna.

warn_details

Logical; if TRUE, a warning is issued when some attribute requested in details is not available in x (parameter for internal use).

n

The minimal number of csf to be calculated.

tt

A truthTab.

asfx

Object of class “condTbl” resulting from asf.

digits

Number of digits to print in consistency, coverage, exhaustiveness, faithfulness, and coherence scores.

quote, row.names

All arguments in condTbl are passed on to condition.

Value

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 are inus
exhaustiveness: the exhaustiveness scores
faithfulness: the faithfulness scores
coherence: the coherence scores

The latter five measures are optional and will be appended to the table according to the setting of the argument details.

Details

Depending on the processed data, the solutions 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 and 5 atomic and complex solution formulas for each outcome. msc can be used to extract all minimally sufficient conditions from an object x of class “cna”, asf to extract all atomic solution formulas, and csf to extract at least n complex solution formulas from 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.

The argument digits applies to the print function. 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(...)).

References

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.

See Also

cna, truthTab, condition, minimalizeCsf, d.irrigate

Examples

Run this code
# NOT RUN {
# 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 = list(c("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)

# Extract only the conditions (solutions).
csf(cna.irrigate)$condition
asf(cna.irrigate)$condition
msc(cna.irrigate)$condition

# A CNA of d.irrigate without a presupposed 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 atomic solutions
# and then pass these asf to csf.
cna2.irrigate.asf <- asf(cna2.irrigate)
# By default, at least 20 csf are generated.
# }
# NOT RUN {
csf(cna2.irrigate, asfx = cna2.irrigate.asf, details = FALSE)
# }
# NOT RUN {
# Generate the first 191 csf.
# }
# NOT RUN {
csf(cna2.irrigate, asfx = cna2.irrigate.asf, 191, details = FALSE)
# }
# NOT RUN {
# Also extract exhaustiveness scores.
# }
# NOT RUN {
csf(cna2.irrigate, asfx = cna2.irrigate.asf, 191, details = "e")
# }
# NOT RUN {
# Generate all 684 csf.
# }
# NOT RUN {
csf(cna2.irrigate, asfx = cna2.irrigate.asf, 684)
# }
# NOT RUN {
# Return solution attributes with 5 digits.
print(cna2.irrigate.asf, digits = 5)

# Another example to the same effect.
# }
# NOT RUN {
print(csf(cna(d.irrigate, ordering = list(c("A","R","F","L","C"),"W"), 
              maxstep = c(4, 4, 12), cov = 0.9)), digits = 5)
# }
# NOT RUN {
# 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(cna.irrigate)$condition, d.irrigate)
condition(asf(cna.irrigate)$condition, d.irrigate)
condition(csf(cna.irrigate)$condition, d.irrigate)

# 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(cna.irrigate)$condition, d.irrigate))
as.condTbl(condition(asf(cna.irrigate)$condition, d.irrigate))
as.condTbl(condition(csf(cna.irrigate)$condition, d.irrigate))

condTbl(csf(cna.irrigate)$condition, d.irrigate) # Same as preceding line
# }

Run the code above in your browser using DataLab