Creates a Causal net, also known as Heuristics net. This is similar to a processmapR process map.
However, the causal map deals with parallelism by trying to identifying causal dependencies
between activities by using different heuristics as documented in dependency_matrix
.
causal_net(
eventlog = NULL,
dependencies = dependency_matrix(eventlog = eventlog, threshold = threshold,
threshold_frequency = threshold_frequency, ...),
bindings = causal_bindings(eventlog, dependencies),
threshold = 0.9,
threshold_frequency = 0,
type = causal_frequency("absolute"),
sec = NULL,
type_nodes = type,
type_edges = type,
sec_nodes = sec,
sec_edges = sec,
...
)
The event log for which a causal map should be computed.
Can be left NULL for more control if parameters dependencies
and bindings
are provided directly.
A dependency matrix created for the event log, for example, by dependency_matrix
.
Causal bindings created by causal_bindings
.
The dependency threshold to be used when using the default dependency matrix computation.
The frequency threshold to be used when using the default dependency matrix computation.
A causal map type. For example, causal_frequency
or causal_performance
.
A causal process map type. Values are shown between brackets.
A causal map type to be used for nodes only.
A causal map type to be used for edges only.
A secondary causal map type for nodes only.
A secondary causal map type for edges only.
Further parameters forwarded to the default dependency_matrix
function.
A DiagrammeR graph of the causal map.
Warning: Projected frequencies are heuristically determined and counts may not add up.
# Causal map with default parameters
causal_net(L_heur_1)
#> Nodes
#> # A tibble: 7 × 12
#> act from_id n n_dist…¹ bindi…² bindi…³ label color…⁴ shape fontc…⁵ color
#> <chr> <int> <dbl> <dbl> <list> <list> <chr> <dbl> <chr> <chr> <chr>
#> 1 End 1 40 40 <list> <list> "End" 40 circ… brown4 brow…
#> 2 Start 2 40 40 <list> <list> "Sta… 40 circ… chartr… char…
#> 3 a 3 40 40 <list> <list> "a\n… 40 rect… white black
#> 4 b 4 21 21 <list> <list> "b\n… 21 rect… black black
#> 5 c 5 21 21 <list> <list> "c\n… 21 rect… black black
#> 6 d 6 17 13 <list> <list> "d\n… 17 rect… black black
#> 7 e 7 40 40 <list> <list> "e\n… 40 rect… white black
#> # … with 1 more variable: tooltip <chr>, and abbreviated variable names
#> # ¹n_distinct_cases, ²bindings_input, ³bindings_output, ⁴color_level,
#> # ⁵fontcolor
#> # ℹ Use `colnames()` to see all variable names
#> Edges
#> # A tibble: 8 × 8
#> antecedent consequent dep from_id to_id n label penwidth
#> <chr> <chr> <dbl> <int> <int> <dbl> <chr> <dbl>
#> 1 e End 0.976 7 1 40 40 5
#> 2 Start a 0.976 2 3 40 40 5
#> 3 a b 0.917 3 4 21 21 3.1
#> 4 a c 0.917 3 5 21 21 3.1
#> 5 a d 0.929 3 6 13 13 2.3
#> 6 b e 0.917 4 7 21 21 3.1
#> 7 c e 0.917 5 7 21 21 3.1
#> 8 d e 0.929 6 7 17 17 2.7
# Causal map with lower dependency treshold
causal_net(L_heur_1, threshold = .8)
#> Nodes
#> # A tibble: 7 × 12
#> act from_id n n_dist…¹ bindi…² bindi…³ label color…⁴ shape fontc…⁵ color
#> <chr> <int> <dbl> <dbl> <list> <list> <chr> <dbl> <chr> <chr> <chr>
#> 1 End 1 40 40 <list> <list> "End" 40 circ… brown4 brow…
#> 2 Start 2 40 40 <list> <list> "Sta… 40 circ… chartr… char…
#> 3 a 3 40 40 <list> <list> "a\n… 40 rect… white black
#> 4 b 4 21 21 <list> <list> "b\n… 21 rect… black black
#> 5 c 5 21 21 <list> <list> "c\n… 21 rect… black black
#> 6 d 6 17 13 <list> <list> "d\n… 17 rect… black black
#> 7 e 7 40 40 <list> <list> "e\n… 40 rect… white black
#> # … with 1 more variable: tooltip <chr>, and abbreviated variable names
#> # ¹n_distinct_cases, ²bindings_input, ³bindings_output, ⁴color_level,
#> # ⁵fontcolor
#> # ℹ Use `colnames()` to see all variable names
#> Edges
#> # A tibble: 10 × 8
#> antecedent consequent dep from_id to_id n label penwidth
#> <chr> <chr> <dbl> <int> <int> <dbl> <chr> <dbl>
#> 1 e End 0.976 7 1 40 40 5
#> 2 Start a 0.976 2 3 40 40 5
#> 3 a b 0.917 3 4 21 21 3.1
#> 4 a c 0.917 3 5 21 21 3.1
#> 5 a d 0.929 3 6 13 13 2.3
#> 6 d d 0.8 6 6 4 4 1.4
#> 7 a e 0.833 3 7 5 5 1.5
#> 8 b e 0.917 4 7 21 21 3.1
#> 9 c e 0.917 5 7 21 21 3.1
#> 10 d e 0.929 6 7 13 13 2.3
# For even more control omit the `eventlog` parameter
# and provide `dependencies` and `bindings` directly.
d <- dependency_matrix(L_heur_1, threshold = .8)
causal_net(dependencies = d,
bindings = causal_bindings(L_heur_1, d, "nearest"))
#> Nodes
#> # A tibble: 7 × 12
#> act from_id n n_dist…¹ bindi…² bindi…³ label color…⁴ shape fontc…⁵ color
#> <chr> <int> <dbl> <dbl> <list> <list> <chr> <dbl> <chr> <chr> <chr>
#> 1 End 1 40 40 <list> <list> "End" 40 circ… brown4 brow…
#> 2 Start 2 40 40 <list> <list> "Sta… 40 circ… chartr… char…
#> 3 a 3 40 40 <list> <list> "a\n… 40 rect… white black
#> 4 b 4 21 21 <list> <list> "b\n… 21 rect… black black
#> 5 c 5 21 21 <list> <list> "c\n… 21 rect… black black
#> 6 d 6 17 13 <list> <list> "d\n… 17 rect… black black
#> 7 e 7 40 40 <list> <list> "e\n… 40 rect… white black
#> # … with 1 more variable: tooltip <chr>, and abbreviated variable names
#> # ¹n_distinct_cases, ²bindings_input, ³bindings_output, ⁴color_level,
#> # ⁵fontcolor
#> # ℹ Use `colnames()` to see all variable names
#> Edges
#> # A tibble: 10 × 8
#> antecedent consequent dep from_id to_id n label penwidth
#> <chr> <chr> <dbl> <int> <int> <dbl> <chr> <dbl>
#> 1 e End 0.976 7 1 40 40 5
#> 2 Start a 0.976 2 3 40 40 5
#> 3 a b 0.917 3 4 21 21 3.1
#> 4 a c 0.917 3 5 21 21 3.1
#> 5 a d 0.929 3 6 13 13 2.3
#> 6 d d 0.8 6 6 4 4 1.4
#> 7 a e 0.833 3 7 5 5 1.5
#> 8 b e 0.917 4 7 21 21 3.1
#> 9 c e 0.917 5 7 21 21 3.1
#> 10 d e 0.929 6 7 13 13 2.3
# The returned DiagrammeR object can be further augmented with
# panning and zooming before rendering:
# \donttest{
library(magrittr)
causal_net(L_heur_1) %>%
render_causal_net(render = TRUE) %>%
DiagrammeRsvg::export_svg() %>%
svgPanZoom::svgPanZoom()
# }