cnaOpt (version 0.1.0)

conCovOpt: Find consistency and coverage optima for configurational data

Description

conCovOpt issues pairs of optimal consistency and coverage scores that atomic solution formulas (asf) of an outcome inferred from configurational data can possibly reach.

Usage

conCovOpt(x, outcome = NULL, 
          type = if (inherits(x, "truthTab")) attr(x, "type") else "cs", 
          maxCombs = 1e+07, approx = FALSE, allConCov = FALSE)
# S3 method for conCovOpt
print(x, ...)
# S3 method for conCovOpt
plot(x, con = 1, cov = 1, ...)

Arguments

x

A data.frame or truthTab. In the print- and plot-method: The output of conCovOpt.

outcome

A character vector of one or several factors in x.

type

A character string specifying the data type; one of "cs", "mv", "fs". Must be specified if the data type is not "cs".

maxCombs

Maximal number of combinations that will be tested for optimality.

approx

Logical; if TRUE, an exhaustive search is only approximated; if FALSE, an exhaustive search is conducted.

allConCov

Logical; if TRUE, all possible con-cov scores are stored as attribute "allConCov"; if FALSE, only the optimal con-cov scores are stored.

con, cov

Numeric scalars between 0 and 1 indicating consistency and coverage thresholds marking the area of "good" models in a square drawn in the plot. Points within the square correspond to models reaching these thresholds.

Currently not used.

Value

An object of class 'conCovOpt'. The exo-groups resulting from step 2 are stored as attribute "exoGroups", the lists of output values resulting from step 3 are stored as attribute "reprodList" (reproduction list), and all possible con-cov scores are stored as attribute "allConCov".

Details

Prior to actual CNA or QCA analyses, conCovOpt calculates consistency and coverage optima for models (i.e. atomic solution formulas, asf) of an outcome inferred from data x.

An ordered pair (con, cov) of consistency and coverage scores is a con-cov optimum for outcome Y=k in data x iff it is not excluded (on principled grounds) for an asf of Y=k inferred from x to reach (con, cov) but excluded to score better on one element of the pair and at least as well on the other.

conCovOpt calculates con-cov optima by executing the following steps:

  1. build exo-groups with constant values in all factors other than the outcome,

  2. assign output values to each exo-group that reproduce the behavior of outcome as closely as possible,

  3. calculate con-cov scores for each assignment resulting in step 3,

  4. eliminate all non-optimal scores.

In case of "cs" and "mv" data, at least one actual model (asf) inferrable from x and reaching an optimum's consistency and coverage scores is guaranteed to exist for every con-cov optimum. The function DNFbuild can be used to build these optimal models. The same does not hold for "fs" data. In case of "fs" data, it merely holds that the existence of a model reaching an optimum's consistency and coverage scores cannot be excluded prior to an actual application of cna.

See Also

truthTab, selectMax, DNFbuild

Examples

Run this code
# NOT RUN {
(cco.irrigate <- conCovOpt(d.irrigate))
conCovOpt(d.irrigate, outcome = c("R","W"))
# Plot method.
plot(cco.irrigate)
plot(cco.irrigate, con = .8, cov = .8)


dat1 <- d.autonomy[15:30, c("EM","SP","CO","AU")]
(cco1 <- conCovOpt(dat1, type = "fs", outcome = "AU"))

print(cco1, digits = 3, row.names = TRUE)
plot(cco1)

# Exo-groups (configurations with constant values in all factors other than the outcome).
attr(cco1$A, "exoGroups")

# Rep-list (list of values optimally reproducing the outcome).
attr(cco1$A, "reprodList")

# allConCov (add all possible con-cov scores, not just optimal ones).
cco1_acc <- conCovOpt(dat1, type = "fs", outcome="AU", allConCov = TRUE) 
attr(cco1_acc$A, "allConCov")
# If the allConCov table has been built, it is passed to the output of selectMax().
sm1 <- selectMax(cco1_acc)
attr(sm1$A, "allConCov")


dat2 <- d.pacts
# Maximal number of combinations exceeds maxCombs.
(cco2 <- conCovOpt(dat2, type = "fs", outcome = "PACT")) # Generates a warning
# Increase maxCombs.
# }
# NOT RUN {
(cco2_full <- try(conCovOpt(dat2, type = "fs", outcome = "PACT", 
  maxCombs=1e+08))) # Takes long or fails due to memory shortage
# }
# NOT RUN {
# Approximate an exhaustive search.
(cco2_approx <- conCovOpt(dat2, type = "fs", outcome = "PACT", approx = TRUE))

# }

Run the code above in your browser using DataCamp Workspace