Learn R Programming

scrutiny (version 1.0.0)

debit_map_total_n: DEBIT-test with hypothetical group sizes

Description

Some studies report group means and standard deviations of binary data but only the total sample size, not the group sizes. For two groups, debit_map_total_n() tests hypothetical splits of the total, as grim_map_total_n() does.

Call audit() on the output for summary statistics.

Usage

debit_map_total_n(
  data,
  digits_x,
  digits_sd,
  x1 = NULL,
  x2 = NULL,
  sd1 = NULL,
  sd2 = 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,
  dispersion = 0:5,
  n_min = NULL,
  n_max = NULL,
  constant = NULL
)

Value

A tibble like that of grim_map_total_n(), with x and sd

columns for the reported values, dir recording which group is paired with the larger group size (the equal split of an even total appears under "forth" only), the other columns of debit_map() output, and the other columns of data.

Arguments

data

Data frame with numeric columns x1, x2, sd1, sd2, and n: the two group means, the two group SDs, and the total sample size. Which group is 1 does not matter, since both pairings with the group sizes are tested, but x1 must belong with sd1 and x2 with sd2.

digits_x, digits_sd

Integer. The number of decimal places in the means and SDs, 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 both groups, or two numbers, one per group, which apply to every row of data. If left out, they are taken from digits_x and digits_sd columns of data, with one number per row for both groups. If the decimal places differ both by group and by row, call the function on each set of rows separately and audit() each output.

x1, x2, sd1, sd2, 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.

dispersion

Numeric. Steps up and down from half the total n. Default is 0:5, i.e., the even split and five steps away from it.

n_min

Numeric. Minimal group size. Default is NULL: 2 under sd_meaning = "sd_sample" or "se", which divide by n - 1, and 1 under "sd_pop" or "sd_sample_or_pop".

n_max

Numeric. Maximal group size. Default is NULL, i.e., no maximum.

constant

Optionally, values that belong to the two groups, such as their labels: a length-2 vector for the groups of x1 and x2, or a list of such vectors. Each becomes a column, as in disperse_total(), and its values stay with their groups in both directions. Default is NULL.

Summaries with <code>audit()</code>

audit() on debit_map_total_n() output returns a tibble with one row per case and these columns:

  • x1, x2, sd1, sd2, and n: the reported values.

  • hits_total: the number of scenarios in which both groups are DEBIT-consistent, summing hits_forth and hits_back.

  • hits_forth: the number of such scenarios with x2 and sd2 paired with the larger group.

  • hits_back: the same with x1 and sd1 paired with the larger group.

  • scenarios_total: the number of scenarios tested, each a split of n with one pairing of groups and statistics, leaving out those that could not be decided.

  • hit_rate: hits_total / scenarios_total, or NA if no scenario could be decided.

A count is NA if it depends on a scenario that could not be decided, or on rows removed from the output, as by filter().

Call audit() again on that summary to summarize these columns further.

References

Bauer, P. J., & Francis, G. (2021). Expression of Concern: Is It Light or Dark? Recalling Moral Behavior Changes Perception of Brightness. Psychological Science, 32(12), 2042–2043. https://journals.sagepub.com/doi/10.1177/09567976211058727

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

See Also

function_map_total_n(), which created this function from debit_map().

Examples

Run this code
df <- tibble::tribble(
  ~x1,  ~x2,  ~sd1,  ~sd2,  ~n,
  0.30, 0.28, 0.17, 0.10, 70,
  0.41, 0.39, 0.09, 0.15, 65
)

debit_map_total_n(df, digits_x = 2, digits_sd = 2, data_type = "integer")

df |>
  debit_map_total_n(digits_x = 2, digits_sd = 2, data_type = "integer") |>
  audit()

Run the code above in your browser using DataLab