prevent | R Documentation |
Prevention refers to the avoidance of component causes, i.e., of elements of sufficient causes. For a given set of component causes, prevent()
derives, which of them need to be "removed" in order to avoid outcome occurrence. Reported are the smallest prevention sets, i.e., with the
fewest component causes.
prevent(scc, causes = NULL, output = c("nice", "table"))
scc |
An object of class |
causes |
A character vector containing step IDs of component causes. If NULL (default), prints a list of all available component causes in the console. |
output |
Either "nice" (default) or "table". If "nice", prints a nicely formatted summary in the console. If "table", returns a data.frame (described in section "Value" below). |
The following algorithm is used to evaluate the effect of prevention:
Evaluate if causes
is sufficient for outcome occurrence. If not, report so and stop.
Derive a list of all combinations of the component causes provided in causes
. The set "all causes present" is not evaluated as it is
already known to be sufficient. In addition, the set "all causes absent", i.e., "all causes prevented" is considered.
Evaluate sufficiency for every set
Subset the list of cause sets to the ones, which are not
sufficient, because for them prevention was successful.
Turn all FALSE to TRUE and all TRUE to FALSE. Now, FALSE indicates present and TRUE indicates absent, i.e., prevented.
Evaluate, which prevention sets are minimal, i.e., the smallest set to prevent the outcome.
If output = "nice"
(default), prints a nicely formatted output in the console. If output = "table"
, returns a data.frame with one
row for every prevention set and one column for every component cause provided in argument causes
. All cells are either TRUE or FALSE with TRUE
indicating that the corresponding variable needs to be prevented in the corresponding set, and FALSE indicating that prevention in the corresponding
set is not necessary.
# Derive SCC model
scc_model <- scc_rain
# Derive prevention sets
prevent(scc_model, causes = c("IFNOTd6a6THENd5a6","THENa5","THENa1","THENd2a3"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.