# 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