| grimmer_map_seq {scrutiny} | R Documentation |
GRIMMER-testing with dispersed inputs
Description
grimmer_map_seq() performs GRIMMER-testing with values
surrounding the input values. This provides an easy and powerful way to
assess whether small errors in computing or reporting may be responsible
for GRIMMER inconsistencies in published statistics.
Call audit_seq() on the results for summary statistics.
Usage
grimmer_map_seq(
data,
x = NULL,
sd = NULL,
n = NULL,
var = Inf,
dispersion = 1:5,
out_min = "auto",
out_max = NULL,
include_reported = FALSE,
include_consistent = FALSE,
...
)
Arguments
data |
A data frame that |
x, sd, n |
Optionally, specify these arguments as column names in |
var |
String. Names of the columns that will be dispersed. Default is
|
dispersion |
Numeric. Sequence with steps up and down from the |
out_min, out_max |
If specified, output will be restricted so that it's
not below |
include_reported |
Logical. Should the reported values themselves be
included in the sequences originating from them? Default is |
include_consistent |
Logical. Should the function also process
consistent cases (from among those reported), not just inconsistent ones?
Default is |
... |
Arguments passed down to |
Value
A tibble (data frame) with detailed test results.
Summaries with audit_seq()
You can call audit_seq()
following grimmer_map_seq(). It will return a data frame with these
columns:
-
x,sd, andnare the original inputs, tested forconsistencyhere. -
hits_totalis the total number of GRIMMER-consistent value sets found within the specifieddispersionrange. -
hits_xis the number of GRIMMER-consistent value sets found by varyingx. Accordingly with
sdandhits_sdas well asnandhits_n.(Note that any consistent reported cases will be counted by the
hits_*columns if bothinclude_reportedandinclude_consistentare set toTRUE.)-
diff_xreports the absolute difference betweenxand the next consistent dispersed value (in dispersion steps, not the actual numeric difference).diff_x_upanddiff_x_downreport the difference to the next higher or lower consistent value, respectively. -
diff_sd,diff_sd_up, anddiff_sd_downdo the same forsd. Likewise with
diff_n,diff_n_up, anddiff_n_down.
Call audit() following audit_seq() to summarize results even
further. It's mostly self-explaining, but na_count and na_rate are the
number and rate of times that a difference could not be computed because of
a lack of corresponding hits within the dispersion range.
Examples
# `grimmer_map_seq()` can take any input
# that `grimmer_map()` can take:
pigs5
# All the results:
out <- grimmer_map_seq(pigs5, include_consistent = TRUE)
out
# Case-wise summaries with `audit_seq()`
# can be more important than the raw results:
out %>%
audit_seq()