Learn R Programming

cna (version 1.0-3)

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

Description

condTbl is a set of three functions that can be used to extract specific elements from an object of class “cna”: msc extracts all minimally sufficient conditions, asf all atomic solution formulas, and csf all complex solution formulas. Moreover, msc, asf, and csf recover corresponding consistency and coverage scores.

as.condTbl reshapes the output produced by condition in such a way as to make it identical to the output returned by msc and asf.

Usage

msc(x) asf(x) csf(x, asfx = asf(x))
"print"(x, digits = 3, ...)
as.condTbl(condlst, ...)

Arguments

x
An object of class “cna”.
asfx
An object of class “condTbl” resulting from asf.
digits
Number of digits to print in consistency and coverage scores.
condlst
A list of objects, each of them of class “cond”, as returned by condition.
...
Passed to print.data.frame.

Value

msc, asf, csf, and as.condTbl return objects of class “condTbl”, which feature the following components:
outcome:
the outcome factors
condition:
the relevant conditions or solutions
consistency:
the consistency scores
coverage:
the coverage scores

Details

Depending on the processed data frame or truth table, the solutions output by cna are sometimes ambiguous, that is, it can happen 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 factor. msc can be used to extract all minimally sufficient conditions from an object of class “cna”, asf to extract all atomic solution formulas, and csf to extract all complex solution formulas. The outputs of msc and asf can be further processed by the condition function.

The argument digits applies to the print function. It determines how many digits of consistency and coverage scores are printed in the outputs of msc, asf, and csf. The default value is 3.

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, d.irrigate

Examples

Run this code
# Lam and Ostrom (2010) on the impact of development interventions on water adequacy in Nepal
#--------------------------------------------------------------------------------------------
# Load dataset. 
data(d.irrigate)

# 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(d.irrigate, ordering = list(c("A","R","F","L","C"),"W"), cov = 0.9)

# The previous function call yields a total of 12 complex solution formulas, only
# 5 of which are printed in the default output. 
# Here is how to extract all 12 complex solution formulas along with corresponding consistency
# and coverage scores.
cna.irrigate <- cna(d.irrigate, ordering = list(c("A","R","F","L","C"),"W"), cov = 0.9)
csf(cna.irrigate)

# Extract all atomic solution formulas along with corresponding consistency and coverage
# scores.
asf(cna.irrigate)

# Extract all minimally sufficient conditions along with corresponding consistency and 
# coverage scores.
msc(cna.irrigate)

# Extract only the conditions or solutions as character vectors.
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 = 0.9)

# To speed up the construction of complex solution formulas, first extract atomic solutions
# and then feed these asf into csf.
cna2.irrigate.asf <- asf(cna2.irrigate) 
csf(cna2.irrigate, cna2.irrigate.asf)

# Return consistency and coverage scores with 5 digits.
print(cna2.irrigate.asf, digits = 5)

# Another example to the same effect.
print(csf(cna(d.irrigate, ordering = list(c("A","R","F","L","C"),"W"), cov = 0.9)), digits = 5)

# Feed the outputs of msc and asf into the condition function to further inspect the properties
# of minimally sufficient conditions and atomic solution formulas.
condition(msc(cna.irrigate)$condition, d.irrigate)
condition(asf(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 and asf.
as.condTbl(condition(msc(cna.irrigate)$condition, d.irrigate))
as.condTbl(condition(asf(cna.irrigate)$condition, d.irrigate))











Run the code above in your browser using DataLab