Skip to contents

Confidence regions are supposed to contain the true "parameter" with a given degree of confidence. Here, "parameter" refers to a murphy curve, a reliability curve, or a ROC curve, respectively.

Usage

add_confidence(x, level = 0.9, method = "resampling_cases", ...)

Arguments

x

An object to which a confidence region should be added.

level

A single value for the level of confidence.

method

A string that gives the name of method to generate the confidence regions. Currently, one of: "resampling_cases", "resampling_Bernoulli".

...

Additional arguments passed to methods.

Value

The object given to x, but with information about the confidence regions. This information can be accessed conveniently by using regions() on the curve component of interest.

Examples

data(ex_binary, package = "triptych")

tr <- triptych(ex_binary) |>
  dplyr::slice(1, 9)

# Bootstrap resampling is expensive
# (the number of bootstrap samples is small to keep execution times short)

tr <- add_confidence(tr, level = 0.9, method = "resampling_cases", n_boot = 20)
regions(tr$murphy)
#> # A tibble: 2,000 × 6
#>    forecast threshold    lower    upper method              level
#>    <chr>        <dbl>    <dbl>    <dbl> <chr>               <dbl>
#>  1 X01        0       0        0        resampling_cases_20   0.9
#>  2 X01        0.00100 0.000627 0.000727 resampling_cases_20   0.9
#>  3 X01        0.00200 0.00118  0.00137  resampling_cases_20   0.9
#>  4 X01        0.00300 0.00172  0.00199  resampling_cases_20   0.9
#>  5 X01        0.00400 0.00224  0.00257  resampling_cases_20   0.9
#>  6 X01        0.00501 0.00278  0.00318  resampling_cases_20   0.9
#>  7 X01        0.00601 0.00327  0.00376  resampling_cases_20   0.9
#>  8 X01        0.00701 0.00377  0.00433  resampling_cases_20   0.9
#>  9 X01        0.00801 0.00423  0.00487  resampling_cases_20   0.9
#> 10 X01        0.00901 0.00472  0.00546  resampling_cases_20   0.9
#> # ℹ 1,990 more rows
regions(tr$reliability)
#> # A tibble: 1,998 × 6
#>    forecast        x lower upper method              level
#>    <chr>       <dbl> <dbl> <dbl> <chr>               <dbl>
#>  1 X01      1.19e-23     0     0 resampling_cases_20   0.9
#>  2 X01      3.84e-23     0     0 resampling_cases_20   0.9
#>  3 X01      9.45e-22     0     0 resampling_cases_20   0.9
#>  4 X01      9.82e-20     0     0 resampling_cases_20   0.9
#>  5 X01      1.13e-19     0     0 resampling_cases_20   0.9
#>  6 X01      4.73e-17     0     0 resampling_cases_20   0.9
#>  7 X01      1.40e-16     0     0 resampling_cases_20   0.9
#>  8 X01      6.33e-16     0     0 resampling_cases_20   0.9
#>  9 X01      1.48e-15     0     0 resampling_cases_20   0.9
#> 10 X01      7.97e-15     0     0 resampling_cases_20   0.9
#> # ℹ 1,988 more rows
regions(tr$roc)
#> # A tibble: 4,004 × 5
#>    forecast   FAR      HR method              level
#>    <chr>    <dbl>   <dbl> <chr>               <dbl>
#>  1 X01          0 0       resampling_cases_20   0.9
#>  2 X01          0 0.00209 resampling_cases_20   0.9
#>  3 X01          0 0.00418 resampling_cases_20   0.9
#>  4 X01          0 0.00628 resampling_cases_20   0.9
#>  5 X01          0 0.00837 resampling_cases_20   0.9
#>  6 X01          0 0.0105  resampling_cases_20   0.9
#>  7 X01          0 0.0126  resampling_cases_20   0.9
#>  8 X01          0 0.0146  resampling_cases_20   0.9
#>  9 X01          0 0.0167  resampling_cases_20   0.9
#> 10 X01          0 0.0188  resampling_cases_20   0.9
#> # ℹ 3,994 more rows