## Introduction A precendence diagrams is a two-dimensional matrix showing the flows between activities. It can be contain different type values, by adjusting the type argument.

  • Absolute frequency of flows
  • Relative frequency of flows
  • Relative frequency of flows, for each antecendent
    • I.e. given antecendent A, it is followed x% of the time by Consequent B
  • Relative frequency of flows, for each consequent
    • I.e. given consequent B, it is preceded x% of the time by Antecedent A

The precedence diagrams can be visualized using the generic plot function. Below, an example of each of the different types is shown.

Examples

Absolute Frequencies

library(bupaR)
patients %>%
    precedence_matrix(type = "absolute") 
## # A tibble: 13 x 3
##    antecedent            consequent                n
##    <fct>                 <fct>                 <int>
##  1 Blood test            End                       1
##  2 Blood test            MRI SCAN                236
##  3 Check-out             End                     492
##  4 Discuss Results       Check-out               492
##  5 Discuss Results       End                       3
##  6 MRI SCAN              Discuss Results         236
##  7 Registration          Triage and Assessment   500
##  8 Start                 Registration            500
##  9 Triage and Assessment Blood test              237
## 10 Triage and Assessment End                       2
## 11 Triage and Assessment X-Ray                   261
## 12 X-Ray                 Discuss Results         259
## 13 X-Ray                 End                       2
patients %>%
    precedence_matrix(type = "absolute") %>%
    plot

Relative Frequencies

patients %>%
    precedence_matrix(type = "relative") %>%
    plot

Antecedent-wise Frequencies

patients %>%
    precedence_matrix(type = "relative_antecedent") %>%
    plot

Consequent-wise Frequencies

patients %>%
    precedence_matrix(type = "relative_consequent") %>%
    plot