debit_map: DEBIT-test many cases at once

debit_mapR Documentation

DEBIT-test many cases at once

Description

debit_map() applies debit() to every row of a data frame with means, standard deviations, and sample sizes of binary data.

Call audit() on the output for summary statistics and debit_plot() to visualize it.

Usage

debit_map(
  data,
  digits_x,
  digits_sd,
  x = NULL,
  sd = NULL,
  n = NULL,
  ...,
  data_type,
  sd_meaning = c("sd_sample", "sd_pop", "sd_sample_or_pop", "se"),
  formula = c("exact", "mean_n"),
  rounding = "up_or_down",
  threshold = 5,
  symmetric = FALSE,
  show_rec = FALSE
)

Arguments

data

Data frame with columns x, sd, and n, and optionally data_type, digits_x, and digits_sd. Any other columns are returned alongside the results.

digits_x, digits_sd

Integer. The number of decimal places in x and sd, including trailing zeros. There are no defaults, since a numeric value does not keep them (1.40 is 1.4). Either a single number for the whole column or one number per row of data. If left out, they are taken from digits_x and digits_sd columns of data.

x, sd, n

Optionally, the names of the columns in data that contain these values, if they differ from the defaults.

...

These dots must be empty. Every argument after them must be named in full.

data_type

String. As in debit(). Give it as an argument or as a column of data; there is no default. It is returned as a column.

formula, rounding, threshold, symmetric, sd_meaning

Passed on to debit(), which explains the defaults.

show_rec

Logical. If TRUE, the reconstructed values are returned as further columns; see Value in debit_map(). Default is FALSE.

Value

A tibble with these columns:

  • x, sd, n: the inputs.

  • data_type: the kind of data, as given.

  • digits_x, digits_sd: the numbers of decimal places, as given.

  • consistency: DEBIT consistency of x, sd, and n. NA for a case that cannot be decided, such as one with a missing value.

  • Any other columns from data.

If show_rec is TRUE, further columns right after consistency hold the reconstructed values: the bounds of sd and x (sd_lower, sd_upper, x_lower, x_upper) with sd_incl_lower and sd_incl_upper saying whether the SD bounds are inclusive; and sum_lower and sum_upper, the least and the greatest number of ones among n values whose mean would be reported as x. Under formula = "exact", a value set is consistent exactly if some k from sum_lower to sum_upper has an SD within the bounds of sd.

The tibble has the class scrutiny_debit_map, which is recognized by audit() and debit_plot().

Summaries with audit()

audit() on debit_map() output returns a tibble with one row and these columns:

  1. all_cases: total number of value sets.

  2. incon_cases: number of DEBIT-inconsistent value sets.

  3. emp_incon: proportion of DEBIT-inconsistent value sets.

  4. mean_x: mean of the x values.

  5. mean_sd: mean of the sd values.

  6. distinct_n: number of distinct n values.

References

Heathers, James A. J., and Brown, Nicholas J. L. 2019. DEBIT: A Simple Consistency Test For Binary Data. https://osf.io/5vb3u/.

See Also

explain_map() and explain_print() to explain each row's result in plain words.

Examples

# Call `debit_map()` on binary summary data such as these:
pigs3

# The `consistency` column shows whether the
# values to its left are DEBIT-consistent:
pigs3 |>
  debit_map(digits_x = 2, digits_sd = 2, data_type = "integer")

# Get test summaries with `audit()`:
pigs3 |>
  debit_map(digits_x = 2, digits_sd = 2, data_type = "integer") |>
  audit()

# Explain the results in plain words:
pigs3 |>
  debit_map(digits_x = 2, digits_sd = 2, data_type = "integer") |>
  explain_print(1:2)

scrutiny documentation built on Nov. 11, 2026, 1:09 a.m.