Skip to contents

Preserved numerical procedures extracted from inferguidR, with explicit inputs, typed statuses and method settings. Calculation and display are separate.

Usage

attach_classification_data(spec, data)

binormal_model(auc, sigma = 1)

binormal_rates(cutoff, auc, sigma = 1)

boschloo_compare_fisher(n1, n2, alpha = 0.05, variant, p1 = NULL, p2 = NULL,
  fisher_convention = c("same", "minlike"), control = boschloo_control())

boschloo_control(tie_tolerance = 1e-07, grid_points = 1001L, nuisance_tol = 1e-09,
  polish_tol = 1e-12, max_levels = 60L, ambiguity_band = c(1e-12, 1e-06), cache = TRUE)

boschloo_plotdata_lattice(n1, n2, alpha = 0.05, variant, p1 = NULL, p2 = NULL,
  observed = NULL, pvalues = TRUE, control = boschloo_control())

boschloo_plotdata_nuisance(x, grid_points = 401L, control = NULL)

boschloo_region(n1, n2, alpha = 0.05, variant, control = boschloo_control())

boschloo_test(x1, n1, x2, n2, variant, alpha = NULL, groups = c("group 1", "group 2"),
  event = "event", control = boschloo_control())

boschloo_variants()

calculator_functions()

calibration_summary(spec, bins = 10)

classification_auc(spec, partial_auc = NULL, level = NULL)

classification_evaluated_spec(x)

classification_metrics(x, count_kind = c("observed", "frequency_weighted", "expected"),
  lang = c("en", "de"))

classification_plot_data(x, panel = .ig_cls_panels, model_id = NULL,
  basis = c("observed", "scenario"), lang = c("en", "de"), ppv_levels = c(0.25, 0.5,
  0.75), f1_levels = c(0.2, 0.4, 0.6, 0.8), ppv_target = NULL, metric_x = "fpr",
  metric_y = "tpr", realised_rules = NULL, bins = 40)

classification_spec(data = NULL, truth = NULL, positive_label = NULL, scores = NULL,
  counts = NULL, theory = NULL, rule = NULL, cutoff = NULL, models = NULL,
  direction = NULL, comparator = NULL, score_scale = c("raw_score", "probability"),
  evaluation_split = NULL, negative_label = NULL, prevalence = NULL,
  prevalence_source = NULL, sampling = NULL, weights = NULL, weight_type = "frequency",
  cluster = NULL, id = NULL, missing = c("error", "exclude"),
  uncertainty = classification_uncertainty())

classification_table(x, table = c("metrics", "intervals", "summaries",
  "operating_point", "curve", "selection", "bounds", "tied",      "scenario",
  "calibration", "net_benefit", "comparisons", "limitations"), model_id = NULL,
  lang = c("en", "de"))

classification_uncertainty(level = 0.95, proportion_methods = c("wilson",
  "clopper_pearson"), auc_method = c("delong", "none"), bootstrap_replicates = 0,
  seed = NULL, bootstrap_strata = c("class", "none"), bootstrap_metrics = c("tpr",
  "fpr", "ppv", "npv", "youden_j", "f1", "mcc", "roc_auc", "average_precision"))

classifier_model(model_id, name = model_id, version = NULL, score_meaning = NULL,
  population = NULL, unit = NULL, source_hash = NULL)

compare_classifiers(spec, level = NULL)

cutoff_rule(cutoff = NULL, selection = NULL, selection_data = NULL, constraints = NULL,
  optimise = NULL, capacity = NULL, costs = NULL, tie_break = NULL,
  prevalence_basis = NULL)

cutoff_sweep(x, metrics = .ig_cls_default_sweep_metrics, model_id = NULL, grid = 401,
  basis = c("observed", "scenario"))

distribution_calculator(expression)

evaluate_cutoff(spec, cutoff = NULL, model_id = NULL, partial_auc = NULL,
  threshold_probability = NULL, calibration_bins = 10, include_curves = TRUE)

ig_status(code, reason = "", details = list())

ig_status_codes()

is_ig_status(x)

metric_dictionary(lang = c("en", "de"), scope = NULL)

net_benefit(spec, threshold_probability)

ppv_gap_max_prevalence(tpr, fpr)

pr_summary(spec, prevalence = NULL)

predictive_values_at_prevalence(tpr, fpr, prevalence)

prevalence_for_ppv_target(tpr, fpr, target)

prevalence_scenario(x, prevalence, n_total = NULL, source = c("assumed", "external"),
  lang = c("en", "de"))

select_cutoff(spec, objective = NULL, constraints = NULL, optimise = NULL,
  capacity = NULL, costs = NULL, tie_break = NULL, prevalence_basis = NULL, ...)

boschloo_inference(x1, n1, x2, n2, variant, alpha = NULL, groups = c("group 1",
  "group 2"), event = "event", control = boschloo_control())

Arguments

spec

A classification specification returned by classification_spec().

data

A data frame containing observations, with explicit truth and score columns.

auc

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

sigma

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

cutoff

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

n1

Number of independent binomial observations in group 1.

n2

Number of independent binomial observations in group 2.

alpha

Decision level strictly between zero and one; NULL omits a decision where supported.

variant

Explicit Boschloo variant: minlike, central, less, or greater. Classifier variants are retained in their records.

p1

Event probability in group 1.

p2

Event probability in group 2.

fisher_convention

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

control

Numerical settings from boschloo_control().

tie_tolerance

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

grid_points

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

nuisance_tol

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

polish_tol

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

max_levels

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

ambiguity_band

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

cache

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

observed

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

pvalues

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

x

Input data, finalized result, or numeric values as specified by the selected function.

x1

Number of events in group 1.

x2

Number of events in group 2.

groups

Two distinct group labels in group 1, group 2 order.

event

Explicit event label.

bins

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

partial_auc

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

level

Confidence level strictly between zero and one.

count_kind

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

lang

Display-label language, en or de.

panel

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

model_id

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

basis

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

ppv_levels

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

f1_levels

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

ppv_target

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

metric_x

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

metric_y

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

realised_rules

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

truth

Name of the observed truth column.

positive_label

Explicit positive-class value; never inferred.

scores

Score column name or named score-column vector.

counts

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

theory

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

rule

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

models

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

direction

Declared score direction, higher_is_positive or lower_is_positive.

comparator

Declared cutoff comparison, consistent with direction.

score_scale

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

evaluation_split

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

negative_label

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

prevalence

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

prevalence_source

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

sampling

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

weights

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

weight_type

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

cluster

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

id

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

missing

Explicit missingness policy; see the preserved specification settings.

uncertainty

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

table

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

proportion_methods

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

auc_method

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

bootstrap_replicates

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

seed

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

bootstrap_strata

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

bootstrap_metrics

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

name

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

version

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

score_meaning

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

population

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

unit

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

source_hash

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

selection

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

selection_data

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

constraints

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

optimise

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

capacity

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

costs

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

tie_break

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

prevalence_basis

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

metrics

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

grid

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

expression

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

threshold_probability

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

calibration_bins

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

include_curves

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

code

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

reason

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

details

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

scope

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

tpr

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

fpr

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

target

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

n_total

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

source

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

objective

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

...

Procedure-specific input, setting, or metadata field. Its accepted values are validated by the function; retained settings are included in the result.

Details

Boschloo tests use Fisher ordering and bounded nuisance maximization. The central variant doubles the smaller separately maximized one-sided value. Rejection uses the numerical upper bound; this bound is not a sampling confidence interval. The shared Boschloo inference path requires only standard R. Historical hashed specifications and the legacy calculator decimal parser require the optional packages digest and/or jsonlite and give an explicit missing-dependency error when absent.

Classifier specifications preserve the positive class, direction, cutoff origin, missing-value exclusions, evaluation split and raw-data fingerprint. Raw observations are not retained in the common reporting payload. Basic count metrics, binormal rates and static dictionary access do not require contributed packages. Undefined metrics retain statuses and denominator reasons.

Provider functions are public interfaces for validated package consumers. Historical canonical primitives accept already converted plain data; guidance-owned schema dispatch remains in inferguidR. No provider evaluates code from input strings. Calculator expressions use a restricted parser.

The inherited validation metadata records prior scoped checks; package extraction and adapter parity do not certify all scientific designs.

Value

Computational functions return typed lists or ordinary data frames; common adapters return inference_result objects. Metadata providers return plain lists or vectors, probability kernels return numeric values, and validators signal typed errors for invalid inputs.

Examples

r <- boschloo_inference(1, 5, 4, 7, variant = "less")
result_data(r)
#>       row_id      component
#> 1 comparison two_group_test
#>                                               estimand          contrast
#> 1 event probability difference (group 1 minus group 2) group 1 - group 2
#>     estimate   p.value   p.upper null.value alternative  n n.excluded status
#> 1 -0.3714286 0.1284041 0.1284041          0        less 12          0     ok
#>   reason decision variable_id statistic df conf.low conf.high conf.level
#> 1            <NA>        <NA>        NA NA       NA        NA         NA
#>   interval.method interval.scale interval.scope p.adjusted p.reported p.method
#> 1            <NA>           <NA>           <NA>         NA  0.1284041     <NA>
#>   family_id family_size
#> 1      <NA>          NA
classification_metrics(c(tp = 8, fn = 2, fp = 3, tn = 7))
#>                 metric_id       value status reason_code reason
#> 1                      tp   8.0000000     ok        <NA>   <NA>
#> 2                      fn   2.0000000     ok        <NA>   <NA>
#> 3                      fp   3.0000000     ok        <NA>   <NA>
#> 4                      tn   7.0000000     ok        <NA>   <NA>
#> 5                n_events  10.0000000     ok        <NA>   <NA>
#> 6            n_non_events  10.0000000     ok        <NA>   <NA>
#> 7                n_alerts  11.0000000     ok        <NA>   <NA>
#> 8            n_non_alerts   9.0000000     ok        <NA>   <NA>
#> 9                 n_total  20.0000000     ok        <NA>   <NA>
#> 10             prevalence   0.5000000     ok        <NA>   <NA>
#> 11             alert_rate   0.5500000     ok        <NA>   <NA>
#> 12                    tpr   0.8000000     ok        <NA>   <NA>
#> 13                    fnr   0.2000000     ok        <NA>   <NA>
#> 14                    tnr   0.7000000     ok        <NA>   <NA>
#> 15                    fpr   0.3000000     ok        <NA>   <NA>
#> 16                    ppv   0.7272727     ok        <NA>   <NA>
#> 17                    fdr   0.2727273     ok        <NA>   <NA>
#> 18                    npv   0.7777778     ok        <NA>   <NA>
#> 19               for_rate   0.2222222     ok        <NA>   <NA>
#> 20               accuracy   0.7500000     ok        <NA>   <NA>
#> 21      balanced_accuracy   0.7500000     ok        <NA>   <NA>
#> 22               youden_j   0.5000000     ok        <NA>   <NA>
#> 23             markedness   0.5050505     ok        <NA>   <NA>
#> 24                     f1   0.7619048     ok        <NA>   <NA>
#> 25                    f05   0.7407407     ok        <NA>   <NA>
#> 26                     f2   0.7843137     ok        <NA>   <NA>
#> 27        fowlkes_mallows   0.7627701     ok        <NA>   <NA>
#> 28                jaccard   0.6153846     ok        <NA>   <NA>
#> 29                    mcc   0.5025189     ok        <NA>   <NA>
#> 30            cohen_kappa   0.5000000     ok        <NA>   <NA>
#> 31                 lr_pos   2.6666667     ok        <NA>   <NA>
#> 32                 lr_neg   0.2857143     ok        <NA>   <NA>
#> 33                    dor   9.3333333     ok        <NA>   <NA>
#> 34          alerts_per_tp   1.3750000     ok        <NA>   <NA>
#> 35              fp_per_tp   0.3750000     ok        <NA>   <NA>
#> 36 fp_per_1000_non_events 300.0000000     ok        <NA>   <NA>
#> 37  missed_per_1000_total 100.0000000     ok        <NA>   <NA>
#> 38               tp_share   0.4000000     ok        <NA>   <NA>
#> 39               fp_share   0.1500000     ok        <NA>   <NA>
#> 40 ppv_gap_max_prevalence   0.3797959     ok        <NA>   <NA>
#>                                                                                            denominator
#> 1                                                                                                 <NA>
#> 2                                                                                                 <NA>
#> 3                                                                                                 <NA>
#> 4                                                                                                 <NA>
#> 5                                                                                                 <NA>
#> 6                                                                                                 <NA>
#> 7                                                                                                 <NA>
#> 8                                                                                                 <NA>
#> 9                                                                                                 <NA>
#> 10                                                                                       N (all units)
#> 11                                                                                       N (all units)
#> 12                                                                             TP + FN (actual events)
#> 13                                                                             TP + FN (actual events)
#> 14                                                                         FP + TN (actual non-events)
#> 15                                                                         FP + TN (actual non-events)
#> 16                                                                                    TP + FP (alerts)
#> 17                                                                                    TP + FP (alerts)
#> 18                                                                         FN + TN (units not alerted)
#> 19                                                                         FN + TN (units not alerted)
#> 20                                                                                       N (all units)
#> 21                                           TP + FN and FP + TN (actual events and actual non-events)
#> 22                                           TP + FN and FP + TN (actual events and actual non-events)
#> 23                                                  TP + FP and FN + TN (alerts and units not alerted)
#> 24                                                                    2TP + FP + FN (2 x TP + FP + FN)
#> 25                                       1.25TP + 0.25FN + FP ((1 + b^2)TP + b^2 FN + FP with b = 0.5)
#> 26                                               5TP + 4FN + FP ((1 + b^2)TP + b^2 FN + FP with b = 2)
#> 27                               sqrt((TP + FP)(TP + FN)) (geometric mean of alerts and actual events)
#> 28                                                                         TP + FN + FP (TP + FN + FP)
#> 29              sqrt((TP + FP)(TP + FN)(TN + FP)(TN + FN)) (product of the four margins (square root))
#> 30 (TP + FP)(FP + TN) + (TP + FN)(FN + TN) (N^2 x (1 - expected chance agreement) / ... (see formula))
#> 31                                                                           FPR (false-positive rate)
#> 32                                                                            TNR (true-negative rate)
#> 33                                                                                   FP x FN (FP x FN)
#> 34                                                                                 TP (true positives)
#> 35                                                                                 TP (true positives)
#> 36                                                                         FP + TN (actual non-events)
#> 37                                                                                       N (all units)
#> 38                                                                                       N (all units)
#> 39                                                                                       N (all units)
#> 40                                                   sqrt(TPR) + sqrt(FPR) (computed from TPR and FPR)
#>    denominator_value                  unit estimate_kind
#> 1                 NA                 count      observed
#> 2                 NA                 count      observed
#> 3                 NA                 count      observed
#> 4                 NA                 count      observed
#> 5                 NA                 count      observed
#> 6                 NA                 count      observed
#> 7                 NA                 count      observed
#> 8                 NA                 count      observed
#> 9                 NA                 count      observed
#> 10          20.00000            proportion      observed
#> 11          20.00000            proportion      observed
#> 12          10.00000            proportion      observed
#> 13          10.00000            proportion      observed
#> 14          10.00000            proportion      observed
#> 15          10.00000            proportion      observed
#> 16          11.00000            proportion      observed
#> 17          11.00000            proportion      observed
#> 18           9.00000            proportion      observed
#> 19           9.00000            proportion      observed
#> 20          20.00000            proportion      observed
#> 21                NA            proportion      observed
#> 22                NA proportion_difference      observed
#> 23                NA proportion_difference      observed
#> 24          21.00000                 score      observed
#> 25          13.50000                 score      observed
#> 26          51.00000                 score      observed
#> 27          10.48809                 score      observed
#> 28          13.00000                 score      observed
#> 29          99.49874           correlation      observed
#> 30         200.00000             agreement      observed
#> 31           0.30000                 ratio      observed
#> 32           0.70000                 ratio      observed
#> 33           6.00000                 ratio      observed
#> 34           8.00000                 ratio      observed
#> 35           8.00000                 ratio      observed
#> 36          10.00000              per_1000      observed
#> 37          20.00000              per_1000      observed
#> 38          20.00000            proportion      observed
#> 39          20.00000            proportion      observed
#> 40           1.44215            proportion      observed