R/utils.R
identify_outliers.Rd
Given a summarized results dataframe, unnest the summary results column and use the value at risk (VaR) column to identify all the elements that are outliers (having a VaR >= two standard deviations)
identify_outliers(results)
Scenario summary results
The supplied dataframe with the following additional columns:
ale_var_zscore
- Annual loss z-score
outlier
- Logical flag when the z-score is greater than or equal to two
data(mc_scenario_summary)
identify_outliers(mc_scenario_summary)
#> # A tibble: 56 × 20
#> scenario_id domain_id control_descriptions results loss_events_mean
#> <chr> <chr> <list> <list> <dbl>
#> 1 RS-01 ORG <named list [7]> <tibble [1,000 ×… 7.48
#> 2 RS-02 ORG <named list [7]> <tibble [1,000 ×… 7.48
#> 3 RS-03 ORG <named list [7]> <tibble [1,000 ×… 1.72
#> 4 RS-04 ORG <named list [8]> <tibble [1,000 ×… 2.73
#> 5 RS-05 ORG <named list [5]> <tibble [1,000 ×… 4.21
#> 6 RS-06 POL <named list [4]> <tibble [1,000 ×… 0
#> 7 RS-07 POL <named list [4]> <tibble [1,000 ×… 0
#> 8 RS-08 POL <named list [4]> <tibble [1,000 ×… 0.042
#> 9 RS-09 COMP <named list [2]> <tibble [1,000 ×… 0
#> 10 RS-10 COMP <named list [2]> <tibble [1,000 ×… 1.90
#> # … with 46 more rows, and 15 more variables: loss_events_median <dbl>,
#> # loss_events_min <int>, loss_events_max <int>, ale_median <dbl>,
#> # ale_max <dbl>, ale_var <dbl>, sle_mean <dbl>, sle_median <dbl>,
#> # sle_min <dbl>, sle_max <dbl>, mean_tc_exceedance <dbl>,
#> # mean_diff_exceedance <dbl>, mean_vuln <dbl>, ale_var_zscore <dbl>,
#> # outlier <lgl>