Construct a precedence matrix, showing how activities are followed by each other. This is a performance improved variant of precedence_matrix in the processmapR package.

precedence_matrix(
  eventlog,
  type = c("absolute", "relative", "relative-antecedent", "relative-consequent",
    "relative-case")
)

Arguments

eventlog

The event log object to be used

type

The type of precedence matrix, which can be absolulte, relative, relative-antecedent or relative-consequent. Absolute will return a matrix with absolute frequencies, relative will return global relative frequencies for all antecedent-consequent pairs. Relative-antecedent will return relative frequencies within each antecendent, i.e. showing the relative proportion of consequents within each antecedent. Relative-consequent will do the reverse.

Examples

m <- precedence_matrix(hospital_multi_perspective, type = "absolute")
print(m)
#> # A tibble: 29 × 3
#>    antecedent         consequent             n
#>    <fct>              <fct>              <int>
#>  1 Triage             Check                  1
#>  2 Final Visit        Triage                 1
#>  3 Check              Organize Ambulance    81
#>  4 Prepare            Organize Ambulance   338
#>  5 Visit              X-Ray                452
#>  6 Organize Ambulance Check                 38
#>  7 X-Ray              Final Visit          810
#>  8 X-Ray              Visit               2079
#>  9 Register           Check               4898
#> 10 Final Visit        Check               3638
#> # … with 19 more rows
#> # ℹ Use `print(n = ...)` to see more rows
as.matrix(m)
#>                     consequent
#> antecedent           Check  End Final Visit Organize Ambulance Prepare Register
#>   Check               5783 2284        5654                 81    3639        0
#>   End                    0    0           0                  0       0        0
#>   Final Visit         3638    0           0                  0    6209        0
#>   Organize Ambulance    38  381           0                  0       0        0
#>   Prepare             2327 7183           0                338       0        0
#>   Register            4898  152           0                  0       0        0
#>   Start                  0    0           0                  0       0        1
#>   Triage                 1    0           0                  0       0     9999
#>   Visit               6012    0        3384                  0       0        0
#>   X-Ray               6959    0         810                  0       0        0
#>                     consequent
#> antecedent           Start Triage Visit X-Ray
#>   Check                  0      0  6827  5388
#>   End                    0      0     0     0
#>   Final Visit            0      1     0     0
#>   Organize Ambulance     0      0     0     0
#>   Prepare                0      0     0     0
#>   Register               0      0   942  4008
#>   Start                  0   9999     0     0
#>   Triage                 0      0     0     0
#>   Visit                  0      0     0   452
#>   X-Ray                  0      0  2079     0