consistency {QCAtools} | R Documentation |
Compute the consistency value
Description
Computes the consistency score of "formula1 -> formula2" (sufficient condition)
or "formula1 <- formula2" (necessary condition), depending on whether type
is "->" or "<-".
If type
is "<->" it computes an equivalence score of formula1 and formula2
via the formula sum(min(X,Y))/(sum(max(X,Y))
Usage
consistency(formula1, type = "->", formula2, data)
Arguments
formula1 |
A string, list of strings or function representing a Boolean formula in disjunctive normal form |
type |
either "->", "<-" or "<->", depending on the direction of the implication that is to be evaluated |
formula2 |
A string, list of strings or function representing a Boolean formula in disjunctive normal form |
data |
A data frame where the rows represent cases and the columns the sets. Column names must be as in the formula. |
Details
Compute a consistency score for an implication/necessity/sufficiency statement.
If formula
is a function, it must take a data.frame
and return
a vector.
If formula
is a string or list of strings, the following conventions hold:
Set names must be capitalized in the formula and the data; if they are
lowercase, they are interpreted as the negation of the set.
If formula
is a string, logical 'or' is expressed as a '+',
and logical 'and' as a '*'.
If formula
is a list of strings, the strings are assumed to be
the dosjuncts and are concatenated with '+'.
The formula must be in disjunctive normal form, i.e. it must be a disjunction of
conjunctions of elementary or negated elementary sets. Example:
A*b*C + a*B
Value
the consistency score of the implication described by formula1
, type
and formula2
Examples
require(QCA)
data(d.urban)
consistency("MLC + FRB", "->", "CP", d.urban)