debit_explain: Explain a DEBIT test step by step

View source: R/debit-explain.R

debit_explainR Documentation

Explain a DEBIT test step by step

Description

[Experimental]

debit_explain() tests a single mean and SD of binary data like debit() does, but also lays out the calculation in plain words: which numbers of ones the mean allows, and whether the SD of any of them would be reported as the given one.

The text is built from the numbers that decide the test itself, so it always agrees with debit().

Usage

debit_explain(
  x,
  sd,
  n,
  digits_x,
  digits_sd,
  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
)

Arguments

x

Numeric. The reported mean of the binary data, between 0 and 1.

sd

Numeric. The reported standard deviation, between 0 and 1.

n

Integer. The reported sample size.

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).

data_type

String. As in grim(): "integer" or "continuous". No default. For DEBIT, "integer" means the binary values 0 and 1 that the test assumes. Continuous data can have any mean and SD from 0 to 1, so the result is TRUE, but a single value can only have an SD of 0. Values outside of 0 to 1 are an error for either data type.

sd_meaning

String. What sd really is: the sample SD, "sd_sample" (the default); the population SD, "sd_pop"; either one, "sd_sample_or_pop"; or the standard error of the mean, "se". As in grimmer(), whose sections Defaults and SD meaning say why the sample SD is the default and when to choose another.

formula

String. Only "exact", the default, can be explained.

rounding

String. The rounding method assumed to have produced x and sd. Default is "up_or_down". See grim() for the others.

threshold, symmetric

The same as in grim().

Value

An object of class scrutiny_explain: a list with the result as consistency (TRUE, FALSE, or NA), the explanation's paragraphs, and the test and its inputs. It prints as the explanation.

Examples

debit_explain(
  x = 0.36,
  sd = 0.11,
  n = 20,
  digits_x = 2,
  digits_sd = 2,
  data_type = "integer"
)

debit_explain(
  x = 0.35,
  sd = 0.49,
  n = 20,
  digits_x = 2,
  digits_sd = 2,
  data_type = "integer"
)

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