Multiple Indicator Sigma Chart

library(qiverse.qimisc)
#> Loading required package: data.table
#> 
#> Attaching package: 'data.table'
#> The following object is masked from 'package:base':
#> 
#>     %notin%
library(qiverse.data)

This package provides functions to prepare data ready for the Multiple Indicator Sigma Chart (MISC), and chart this using plotly.

Prepare MISC Data

The data that feeds into the Multiple Indicator Sigma Chart requires preparation using the misc_prep_data function. This takes two inputs:

  • funnel_data - A data.frame/data.table of the funnel data with the columns indicator, group, numerator and denominator.

  • indicator_data - A data.frame/data.table of the indicator metadata with the columns indicator_theme, indicator, multiplier, data_type and betteris.

Examples of these datasets are below:

example_funnel_data
#>                        indicator  group   numerator  denominator
#>                           <char> <char>       <num>        <num>
#>  1: Standardised Mortality Ratio      A    99.48906    128.44900
#>  2: Standardised Mortality Ratio      B   607.97498    424.11760
#>  3: Standardised Mortality Ratio      C   431.15667    478.16069
#>  4: Standardised Mortality Ratio      D   316.59798    184.60084
#>  5: Standardised Mortality Ratio      E   103.35484     49.74442
#>  6: Standardised Mortality Ratio      F   209.65384    448.20598
#>  7: Standardised Mortality Ratio      G    24.81275     23.96733
#>  8: Standardised Mortality Ratio      H    35.93247     19.29061
#>  9: Standardised Mortality Ratio      I   172.13191    162.31811
#> 10: Standardised Mortality Ratio      J    33.24240     35.02003
#> 11: Standardised Mortality Ratio      L    46.19217     19.55709
#> 12:              Crude Mortality      A  3244.00000 128449.00000
#> 13:              Crude Mortality      B 18286.00000 424118.00000
#> 14:              Crude Mortality      C 16624.00000 478161.00000
#> 15:              Crude Mortality      D  5885.00000 184601.00000
#> 16:              Crude Mortality      E  1099.00000  49744.00000
#> 17:              Crude Mortality      F 17587.00000 448206.00000
#> 18:              Crude Mortality      G   304.00000  23967.00000
#> 19:              Crude Mortality      H   571.00000  19291.00000
#> 20:              Crude Mortality      I  9578.00000 162318.00000
#> 21:              Crude Mortality      J   592.00000  35020.00000
#> 22:              Crude Mortality      L   974.00000  19557.00000
#> 23:            Caesarean Section      A   184.00000    642.00000
#> 24:            Caesarean Section      B   639.00000   2121.00000
#> 25:            Caesarean Section      C   733.00000   2391.00000
#> 26:            Caesarean Section      D   298.00000    923.00000
#> 27:            Caesarean Section      E    69.00000    249.00000
#> 28:            Caesarean Section      F   845.00000   2241.00000
#> 29:            Caesarean Section      G    48.00000    120.00000
#> 30:            Caesarean Section      H    32.00000     96.00000
#> 31:            Caesarean Section      I   244.00000    812.00000
#> 32:            Caesarean Section      J    52.00000    175.00000
#> 33:            Caesarean Section      L    38.00000     98.00000
#> 34:              Pressure Injury      A    25.00000 128449.00000
#> 35:              Pressure Injury      B    47.00000 424118.00000
#> 36:              Pressure Injury      C    78.00000 478161.00000
#> 37:              Pressure Injury      D    35.00000 184601.00000
#> 38:              Pressure Injury      E    13.00000  49744.00000
#> 39:              Pressure Injury      F    93.00000 448206.00000
#> 40:              Pressure Injury      G     7.00000  23967.00000
#> 41:              Pressure Injury      H    11.00000  19291.00000
#> 42:              Pressure Injury      I    53.00000 162318.00000
#> 43:              Pressure Injury      J     5.00000  35020.00000
#> 44:              Pressure Injury      L     2.00000  19557.00000
#> 45:                        Falls      A    31.00000 128449.00000
#> 46:                        Falls      B    85.00000 424118.00000
#> 47:                        Falls      C   166.00000 478161.00000
#> 48:                        Falls      D    26.00000 184601.00000
#> 49:                        Falls      E    12.00000  49744.00000
#> 50:                        Falls      F    41.00000 448206.00000
#> 51:                        Falls      G     4.00000  23967.00000
#> 52:                        Falls      H     7.00000  19291.00000
#> 53:                        Falls      I    39.00000 162318.00000
#> 54:                        Falls      J     7.00000  35020.00000
#> 55:                        Falls      L     2.00000  19557.00000
#> 56:  Staff Feel Safe To Speak Up      A   380.00000    642.00000
#> 57:  Staff Feel Safe To Speak Up      B  1050.00000   2121.00000
#> 58:  Staff Feel Safe To Speak Up      C  1356.00000   2391.00000
#> 59:  Staff Feel Safe To Speak Up      D   367.00000    923.00000
#> 60:  Staff Feel Safe To Speak Up      E    99.00000    249.00000
#> 61:  Staff Feel Safe To Speak Up      F  1153.00000   2241.00000
#> 62:  Staff Feel Safe To Speak Up      G    66.00000    120.00000
#> 63:  Staff Feel Safe To Speak Up      H    40.00000     96.00000
#> 64:  Staff Feel Safe To Speak Up      I   381.00000    812.00000
#> 65:  Staff Feel Safe To Speak Up      J    97.00000    175.00000
#> 66:  Staff Feel Safe To Speak Up      L    31.00000     98.00000
#>                        indicator  group   numerator  denominator
#>                           <char> <char>       <num>        <num>
example_indicator_data
#>                    indicator_theme                    indicator multiplier
#>                             <char>                       <char>      <num>
#> 1:                       Mortality Standardised Mortality Ratio        100
#> 2:                       Mortality              Crude Mortality      10000
#> 3:                       Maternity            Caesarean Section        100
#> 4: Hospital Acquired Complications              Pressure Injury       1000
#> 5: Hospital Acquired Complications                        Falls       1000
#> 6:                Staff Experience  Staff Feel Safe To Speak Up          1
#>    data_type betteris
#>       <char>   <char>
#> 1:        SR    Lower
#> 2:        PR    Lower
#> 3:        PR    Lower
#> 4:        PR    Lower
#> 5:        PR    Lower
#> 6:        PR   Higher

These datasets must be in the above format to feed into the MISC data preparation.

misc_data <- misc_prep_data(example_funnel_data, example_indicator_data)
misc_data
#>      group                    indicator   numerator  denominator multiplier
#>     <char>                       <char>       <num>        <num>      <num>
#>  1:      A Standardised Mortality Ratio    99.48906    128.44900        100
#>  2:      B Standardised Mortality Ratio   607.97498    424.11760        100
#>  3:      C Standardised Mortality Ratio   431.15667    478.16069        100
#>  4:      D Standardised Mortality Ratio   316.59798    184.60084        100
#>  5:      E Standardised Mortality Ratio   103.35484     49.74442        100
#>  6:      F Standardised Mortality Ratio   209.65384    448.20598        100
#>  7:      G Standardised Mortality Ratio    24.81275     23.96733        100
#>  8:      H Standardised Mortality Ratio    35.93247     19.29061        100
#>  9:      I Standardised Mortality Ratio   172.13191    162.31811        100
#> 10:      J Standardised Mortality Ratio    33.24240     35.02003        100
#> 11:      L Standardised Mortality Ratio    46.19217     19.55709        100
#> 12:      A              Crude Mortality  3244.00000 128449.00000      10000
#> 13:      B              Crude Mortality 18286.00000 424118.00000      10000
#> 14:      C              Crude Mortality 16624.00000 478161.00000      10000
#> 15:      D              Crude Mortality  5885.00000 184601.00000      10000
#> 16:      E              Crude Mortality  1099.00000  49744.00000      10000
#> 17:      F              Crude Mortality 17587.00000 448206.00000      10000
#> 18:      G              Crude Mortality   304.00000  23967.00000      10000
#> 19:      H              Crude Mortality   571.00000  19291.00000      10000
#> 20:      I              Crude Mortality  9578.00000 162318.00000      10000
#> 21:      J              Crude Mortality   592.00000  35020.00000      10000
#> 22:      L              Crude Mortality   974.00000  19557.00000      10000
#> 23:      A            Caesarean Section   184.00000    642.00000        100
#> 24:      B            Caesarean Section   639.00000   2121.00000        100
#> 25:      C            Caesarean Section   733.00000   2391.00000        100
#> 26:      D            Caesarean Section   298.00000    923.00000        100
#> 27:      E            Caesarean Section    69.00000    249.00000        100
#> 28:      F            Caesarean Section   845.00000   2241.00000        100
#> 29:      G            Caesarean Section    48.00000    120.00000        100
#> 30:      H            Caesarean Section    32.00000     96.00000        100
#> 31:      I            Caesarean Section   244.00000    812.00000        100
#> 32:      J            Caesarean Section    52.00000    175.00000        100
#> 33:      L            Caesarean Section    38.00000     98.00000        100
#> 34:      A              Pressure Injury    25.00000 128449.00000       1000
#> 35:      B              Pressure Injury    47.00000 424118.00000       1000
#> 36:      C              Pressure Injury    78.00000 478161.00000       1000
#> 37:      D              Pressure Injury    35.00000 184601.00000       1000
#> 38:      E              Pressure Injury    13.00000  49744.00000       1000
#> 39:      F              Pressure Injury    93.00000 448206.00000       1000
#> 40:      G              Pressure Injury     7.00000  23967.00000       1000
#> 41:      H              Pressure Injury    11.00000  19291.00000       1000
#> 42:      I              Pressure Injury    53.00000 162318.00000       1000
#> 43:      J              Pressure Injury     5.00000  35020.00000       1000
#> 44:      L              Pressure Injury     2.00000  19557.00000       1000
#> 45:      A                        Falls    31.00000 128449.00000       1000
#> 46:      B                        Falls    85.00000 424118.00000       1000
#> 47:      C                        Falls   166.00000 478161.00000       1000
#> 48:      D                        Falls    26.00000 184601.00000       1000
#> 49:      E                        Falls    12.00000  49744.00000       1000
#> 50:      F                        Falls    41.00000 448206.00000       1000
#> 51:      G                        Falls     4.00000  23967.00000       1000
#> 52:      H                        Falls     7.00000  19291.00000       1000
#> 53:      I                        Falls    39.00000 162318.00000       1000
#> 54:      J                        Falls     7.00000  35020.00000       1000
#> 55:      L                        Falls     2.00000  19557.00000       1000
#> 56:      A  Staff Feel Safe To Speak Up   380.00000    642.00000          1
#> 57:      B  Staff Feel Safe To Speak Up  1050.00000   2121.00000          1
#> 58:      C  Staff Feel Safe To Speak Up  1356.00000   2391.00000          1
#> 59:      D  Staff Feel Safe To Speak Up   367.00000    923.00000          1
#> 60:      E  Staff Feel Safe To Speak Up    99.00000    249.00000          1
#> 61:      F  Staff Feel Safe To Speak Up  1153.00000   2241.00000          1
#> 62:      G  Staff Feel Safe To Speak Up    66.00000    120.00000          1
#> 63:      H  Staff Feel Safe To Speak Up    40.00000     96.00000          1
#> 64:      I  Staff Feel Safe To Speak Up   381.00000    812.00000          1
#> 65:      J  Staff Feel Safe To Speak Up    97.00000    175.00000          1
#> 66:      L  Staff Feel Safe To Speak Up    31.00000     98.00000          1
#>      group                    indicator   numerator  denominator multiplier
#>     <char>                       <char>       <num>        <num>      <num>
#>     data_type betteris                 indicator_theme      uzscore
#>        <char>   <char>                          <char>        <num>
#>  1:        SR    Lower                       Mortality  -2.74730866
#>  2:        SR    Lower                       Mortality   7.85962588
#>  3:        SR    Lower                       Mortality  -2.20895121
#>  4:        SR    Lower                       Mortality   8.00824809
#>  5:        SR    Lower                       Mortality   5.79042736
#>  6:        SR    Lower                       Mortality -14.26573781
#>  7:        SR    Lower                       Mortality   0.03580610
#>  8:        SR    Lower                       Mortality   2.91488949
#>  9:        SR    Lower                       Mortality   0.70361850
#> 10:        SR    Lower                       Mortality  -0.24901896
#> 11:        SR    Lower                       Mortality   4.30867368
#> 12:        PR    Lower                       Mortality -25.99812474
#> 13:        PR    Lower                       Mortality  17.32165628
#> 14:        PR    Lower                       Mortality -11.49224830
#> 15:        PR    Lower                       Mortality -14.05326496
#> 16:        PR    Lower                       Mortality -20.82015540
#> 17:        PR    Lower                       Mortality   4.74137389
#> 18:        PR    Lower                       Mortality -25.69956831
#> 19:        PR    Lower                       Mortality  -6.37808566
#> 20:        PR    Lower                       Mortality  39.88928603
#> 21:        PR    Lower                       Mortality -24.50675823
#> 22:        PR    Lower                       Mortality   8.16592766
#> 23:        PR    Lower                       Maternity  -1.97468005
#> 24:        PR    Lower                       Maternity  -2.10621830
#> 25:        PR    Lower                       Maternity  -1.67351809
#> 26:        PR    Lower                       Maternity   0.02624257
#> 27:        PR    Lower                       Maternity  -1.56285087
#> 28:        PR    Lower                       Maternity   5.42448997
#> 29:        PR    Lower                       Maternity   1.77078013
#> 30:        PR    Lower                       Maternity   0.22702245
#> 31:        PR    Lower                       Maternity  -1.35168493
#> 32:        PR    Lower                       Maternity  -0.72431276
#> 33:        PR    Lower                       Maternity   1.35215077
#> 34:        PR    Lower Hospital Acquired Complications   0.19840800
#> 35:        PR    Lower Hospital Acquired Complications  -4.09946542
#> 36:        PR    Lower Hospital Acquired Complications  -1.24779104
#> 37:        PR    Lower Hospital Acquired Complications   0.08186280
#> 38:        PR    Lower Hospital Acquired Complications   1.11161123
#> 39:        PR    Lower Hospital Acquired Complications   0.97813218
#> 40:        PR    Lower Hospital Acquired Complications   1.05774449
#> 41:        PR    Lower Hospital Acquired Complications   2.83528506
#> 42:        PR    Lower Hospital Acquired Complications   3.54234744
#> 43:        PR    Lower Hospital Acquired Complications  -0.64579793
#> 44:        PR    Lower Hospital Acquired Complications  -0.99621914
#> 45:        PR    Lower Hospital Acquired Complications   0.67856206
#> 46:        PR    Lower Hospital Acquired Complications  -0.56242649
#> 47:        PR    Lower Hospital Acquired Complications   5.59317900
#> 48:        PR    Lower Hospital Acquired Complications  -2.33821243
#> 49:        PR    Lower Hospital Acquired Complications   0.42075496
#> 50:        PR    Lower Hospital Acquired Complications  -6.72785374
#> 51:        PR    Lower Hospital Acquired Complications  -0.51705214
#> 52:        PR    Lower Hospital Acquired Complications   1.23919848
#> 53:        PR    Lower Hospital Acquired Complications   0.73496374
#> 54:        PR    Lower Hospital Acquired Complications  -0.16862775
#> 55:        PR    Lower Hospital Acquired Complications  -1.25199366
#> 56:        PR   Higher                Staff Experience   4.24205608
#> 57:        PR   Higher                Staff Experience  -1.25876170
#> 58:        PR   Higher                Staff Experience   5.73225099
#> 59:        PR   Higher                Staff Experience  -6.79489467
#> 60:        PR   Higher                Staff Experience  -3.53008467
#> 61:        PR   Higher                Staff Experience   0.54809409
#> 62:        PR   Higher                Staff Experience   0.90633253
#> 63:        PR   Higher                Staff Experience  -1.81143724
#> 64:        PR   Higher                Staff Experience  -2.25247265
#> 65:        PR   Higher                Staff Experience   1.20851187
#> 66:        PR   Higher                Staff Experience  -3.89630134
#>     data_type betteris                 indicator_theme      uzscore
#>        <char>   <char>                          <char>        <num>
#>            lcl99       ucl99          cl
#>            <num>       <num>       <num>
#>  1: 7.493480e+01 130.3820619 105.4274674
#>  2: 8.566380e+01 115.9331108 105.4274674
#>  3: 8.646171e+01 114.9538450 105.4274674
#>  4: 7.878945e+01 124.8989880 105.4274674
#>  5: 6.183444e+01 152.0391359 105.4274674
#>  6: 8.603670e+01 115.4739501 105.4274674
#>  7: 4.850359e+01 180.6110583 105.4274674
#>  8: 4.403358e+01 192.2775810 105.4274674
#>  9: 7.748819e+01 126.7108498 105.4274674
#> 10: 5.577667e+01 164.0282507 105.4274674
#> 11: 4.432196e+01 191.4855773 105.4274674
#> 12: 3.624637e+02 395.3824825 378.7513327
#> 13: 3.697452e+02 387.8614966 378.7513327
#> 14: 3.702666e+02 387.3283891 378.7513327
#> 15: 3.651411e+02 392.6006279 378.7513327
#> 16: 3.527465e+02 405.6433189 378.7513327
#> 17: 3.699892e+02 387.6119346 378.7513327
#> 18: 3.415699e+02 417.7739976 378.7513327
#> 19: 3.374262e+02 422.3639714 378.7513327
#> 20: 3.642454e+02 393.5291326 378.7513327
#> 21: 3.478600e+02 410.9028402 378.7513327
#> 22: 3.377004e+02 422.0586586 378.7513327
#> 23: 2.669095e+01  38.0640955  32.2456425
#> 24: 2.915160e+01  35.4195955  32.2456425
#> 25: 2.932909e+01  35.2330853  32.2456425
#> 26: 2.759122e+01  37.0835995  32.2456425
#> 27: 2.348973e+01  41.6802880  32.2456425
#> 28: 2.923440e+01  35.3325160  32.2456425
#> 29: 1.993586e+01  45.9589625  32.2456425
#> 30: 1.862249e+01  47.6203089  32.2456425
#> 31: 2.729093e+01  37.4089513  32.2456425
#> 32: 2.190806e+01  43.5476586  32.2456425
#> 33: 1.874858e+01  47.4587594  32.2456425
#> 34: 8.767174e-02   0.3234544   0.1869839
#> 35: 1.277313e-01   0.2574903   0.1869839
#> 36: 1.308716e-01   0.2530781   0.1869839
#> 37: 1.015713e-01   0.2982520   0.1869839
#> 38: 4.552004e-02   0.4243971   0.1869839
#> 39: 1.291964e-01   0.2554205   0.1869839
#> 40: 1.364621e-02   0.5594630   0.1869839
#> 41: 6.502737e-03   0.6148750   0.1869839
#> 42: 9.681307e-02   0.3065597   0.1869839
#> 43: 2.935441e-02   0.4809033   0.1869839
#> 44: 6.895663e-03   0.6111171   0.1869839
#> 45: 1.056323e-01   0.3571785   0.2128272
#> 46: 1.492367e-01   0.2876710   0.2128272
#> 47: 1.526296e-01   0.2830062   0.2128272
#> 48: 1.208393e-01   0.3306693   0.2128272
#> 49: 5.869574e-02   0.4629031   0.2128272
#> 50: 1.508200e-01   0.2854829   0.2128272
#> 51: 2.123877e-02   0.6035468   0.2128272
#> 52: 1.200294e-02   0.6610486   0.2128272
#> 53: 1.156442e-01   0.3394137   0.2128272
#> 54: 4.009979e-02   0.5218375   0.2128272
#> 55: 1.253471e-02   0.6571520   0.2128272
#> 56: 4.478297e+01  56.9470860  50.8715039
#> 57: 4.751758e+01  54.2215027  50.8715039
#> 58: 4.771246e+01  54.0270665  50.8715039
#> 59: 4.579072e+01  55.9432741  50.8715039
#> 60: 4.112702e+01  60.5826738  50.8715039
#> 61: 4.760854e+01  54.1307595  50.8715039
#> 62: 3.692059e+01  64.7535227  50.8715039
#> 63: 3.532125e+01  66.3357832  50.8715039
#> 64: 4.545553e+01  56.2772344  50.8715039
#> 65: 3.927555e+01  62.4201166  50.8715039
#> 66: 3.547594e+01  66.1828286  50.8715039
#>            lcl99       ucl99          cl
#>            <num>       <num>       <num>

Charting MISC in Plotly

This package provides a function to plot the MISC output using Plotly. An example of this is as follows:

misc_plotly(misc_data[group == "A"])