detailMeasures: Calculate evaluation measures and solution attributes for...

View source: R/detailMeasures.R

detailMeasuresR Documentation

Calculate evaluation measures and solution attributes for msc, asf, and csf

Description

detailMeasures can calculate all available measures for sufficiency and necessity evaluation (e.g. prevalence-adjusted consistency and antecedent-adjusted coverage), independently of whether they are used for model building, as well as additional solution attributes (e.g. exhaustiveness or faithfulness).

Usage

detailMeasures(
  cond, x, what = TRUE,
  inus.def = "implication", inus.func.minim = FALSE,
  cycle.type = c("factor", "value"), ...)

Arguments

cond

Character vector specifying a set of minimally sufficient conditions (msc) or solution formulas (asf or csf) in the standard format (cf. condition/condList). Blanks are allowed.

x

Data frame, configTable, or matrix.

what

Character vector specifying the evaluation measures and additional solution attributes to be computed. Possible elements are all the measures in showMeasures. Can also be TRUE/FALSE. If FALSE, no additional measures are returned; TRUE resolves to all solution attributes listed in showDetailMeasures except redundant, which must be requested explicitly.
The attributes that apply to csf only (coherence, fm_structural, fm_empirical) are computed only for csf.

inus.def, inus.func.minim

Passed to is.inus: inus.def selects the definition of partial structural redundancy, inus.func.minim determines whether functional minimality (in the sense of fm_structural) is required for elements of cond to pass as having INUS form.

cycle.type

Character string specifying what type of cycles to be detected: "factor" (the default) or "value" (cf. cyclic).

...

Further arguments passed to the .det methods, e.g. type when x is a data frame (cf. configTable).

Details

The cna function can build its models using one out of four measures for sufficiency evaluation and one out of four measures for necessity evaluation (cf. section 3.2 of the cna package vignette, call vignette("cna"), or De Souter & Baumgartner 2025). The measures that are not used for model building may still be useful for cross-validation or selecting among the resulting models. The detailMeasures function can calculate all these measures, independently of whether they are used for model building. The measures can be passed to the detailMeasures function by their names or aliases in showConCovMeasures.

In addition, detailMeasures computes exhaustiveness, faithfulness, and coherence, which are three measures for overall data fit (cf. sections 5.2 and 5.3 of vignette("cna")). It identifies formulas with cyclic substructures and determines whether they have inus form or redundant parts. How much information these two attributes carry depends on how the models were built: csf returned by cna at its default inus.only = TRUE are free of structural redundancies, so redundant is FALSE and inus TRUE for all of them; models built with inus.only = FALSE or supplied by the user need not be either. These additional solution attributes are passed to the detailMeasures function by their names in showDetailMeasures.

Notes: First, coherence, fm_structural, fm_empirical and redundant apply to complex solution formulas (csf) only; when they are requested for asf, placeholder values are returned (coherence is set to 1, redundant to FALSE, and the two fm* measures to NA). inus, cyclic, exhaustiveness and faithfulness, by contrast, are computed and meaningful for msc, asf, and csf alike. Second, redundant and inus are interdependent as follows: if redundant is TRUE for a csf, then inus is FALSE for that csf (see example below). Third, whether the csf-only attributes are computed or returned as placeholders depends on the class of cond: conditions from a solution table (cf. cna-solutions) carry the class stdAtomic or stdComplex, but if that class is dropped—for instance by applying c() to the vector—the type is re-derived from the syntax, and a csf that consists of a single asf is treated as an asf.

Value

An object of class “condTbl”, a data.frame with the columns outcome and condition followed by the requested measures and solution attributes.

References

De Souter, Luna and Michael Baumgartner. 2025. “New sufficiency and necessity measures for model building with Coincidence Analysis.” Zenodo. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.5281/zenodo.13619580")}

See Also

cna, msc, asf, csf, configTable, condition, cyclic, showMeasures, showConCovMeasures, showDetailMeasures, func_minim, redundant

Examples

cond <- csf(cna(d.women))$condition
detailMeasures(cond, d.women)
detailMeasures(cond, d.women, what = c("ex", "fa", "PAcon", "PACcov", "AACcon", 
                                       "AAcov"))

# The functional-minimality measures are computed for csf only; for the asf in
# the first row, the placeholder value NA is returned.
detailMeasures(c("ES*ws*WNP -> QU",
                 "(ES + WM <-> QU)*(WS + ES*WM + QU*LP + WM*LP <-> WNP)"),
              d.women, what = c("fm_empirical", "fm_structural"))

# Mixing msc, asf and csf.
detailMeasures(c("ES*ws*WNP -> QU", "QU*LP + WM*LP <-> WNP", 
                 "(ES + WM <-> QU)*(WS + ES*WM + QU*LP + WM*LP <-> WNP)"),
              d.women)

# In the following example, the csf is not inus, although all its component asfs are:
cond <- c("(f+a*D <-> C)", "(C+A*B <-> D)", "(c+a*E <-> F)", 
          "(f+a*D <-> C)*(C+A*B <-> D)*(c+a*E <-> F)")
ct <- full.ct(cond)
detailMeasures(cond, ct)
# The reason is that one of the asfs is redundant:
redundant(cond[4])

# INUS form can additionally be required to include functional minimality
# (inus.func.minim, cf. is.inus and func_minim). The second csf below contains
# a factor that is functionally redundant in the sense of fm_structural().
aircon <- selectCases("(A + B <-> E1)*(A*b + A*C <-> E2)")
cond2 <- csf(cna(aircon))$condition
detailMeasures(cond2, aircon, what = "inus")
detailMeasures(cond2, aircon, what = "inus", inus.func.minim = TRUE)

cna documentation built on Oct. 28, 2026, 9:07 a.m.