Call grim_map()
to GRIM-test any number of combinations of
mean/proportion, sample size, and number of items. Mapping function for
GRIM-testing.
Set percent
to TRUE
if the x
values are percentages. This will
convert x
values to decimals and adjust the decimal count accordingly.
Display intermediary numbers from GRIM-testing in columns by setting
show_rec
to TRUE
.
For summary statistics, call [audit()
] on the results.
grim_map(
data,
items = 1,
merge_items = TRUE,
percent = FALSE,
x = NULL,
n = NULL,
show_rec = FALSE,
show_prob = FALSE,
rounding = "up_or_down",
threshold = 5,
symmetric = FALSE,
tolerance = .Machine$double.eps^0.5,
testables_only = FALSE,
extra = Inf
)
A tibble with these columns --
x
, n
: the inputs.
consistency
: GRIM consistency of x
, n
, and items
.
<extra>
: any columns from data
other than x
, n
, and items
.
ratio
: the GRIM ratio; see grim_ratio()
.
The tibble has the scr_grim_map
class, which is recognized by the
audit()
generic.
Data frame with columns x
, n
, and optionally items
(see
documentation for grim()
. By default, any other columns in data
will
be returned alongside GRIM test results (see extra
below).
Integer. If there is no items
column in data
, this specifies
the number of items composing the x
values. Default is 1, the most common
case.
Logical. If TRUE
(the default), there will be no items
column in the output. Instead, values from an items
column or argument
will be multiplied with values in the n
column. This does not affect
GRIM-testing.
Logical. Set percent
to TRUE
if the x
values are
percentages. This will convert them to decimal numbers and adjust the
decimal count (i.e., increase it by 2). It also affects the ratio
column.
Default is FALSE
.
Optionally, specify these arguments as column names in data
.
Logical. If set to TRUE
, the reconstructed numbers from
GRIM-testing are shown as columns. See section Reconstructed numbers
below. Default is FALSE
.
Logical. If set to TRUE
, adds a prob
column that
contains the probability of GRIM inconsistency. This is simply the ratio
column censored to range between 0 and 1. Default is FALSE
.
Further parameters of
GRIM-testing; see documentation for grim()
.
Logical. If testables_only
is set to TRUE
, only
GRIM-testable cases (i.e., those with a positive GRIM ratio) are included.
Default is FALSE
.
String or integer. The other column(s) from data
to be
returned in the output tibble alongside test results, referenced by their
name(s) or number(s). Default is Inf
, which returns all columns. To
return none of them, set extra
to 0.
If show_rec
is set to TRUE
, the output
includes the following additional columns:
rec_sum
: the sum total from which the mean or proportion was ostensibly
derived.
rec_x_upper
: the upper reconstructed x
value.
rec_x_lower
: the lower reconstructed x
value.
rec_x_upper_rounded
: the rounded rec_x_upper
value.
rec_x_lower_rounded
: the rounded rec_x_lower
value.
With the default for rounding
, "up_or_down"
, each of the last two columns
is replaced by two columns that specify the rounding procedures (i.e.,
"_up"
and "_down"
).
There is an S3 method for audit()
,
so you can call audit()
following grim_map()
to get a summary of
grim_map()
's results. It is a tibble with one row and these columns --
incons_cases
: number of GRIM-inconsistent value sets.
all_cases
: total number of value sets.
incons_rate
: proportion of GRIM-inconsistent value sets.
mean_grim_ratio
: average of GRIM ratios.
incons_to_ratio
: ratio of incons_rate
to mean_grim_ratio
.
testable_cases
: number of GRIM-testable value sets (i.e., those with a
positive ratio).
testable_rate
: proportion of GRIM-testable value sets.
Brown, N. J. L., & Heathers, J. A. J. (2017). The GRIM Test: A Simple Technique Detects Numerous Anomalies in the Reporting of Results in Psychology. Social Psychological and Personality Science, 8(4), 363–369. https://journals.sagepub.com/doi/10.1177/1948550616673876
# Use `grim_map()` on data like these:
pigs1
# The `consistency` column shows
# whether the values to its left
# are GRIM-consistent:
pigs1 %>%
grim_map()
# Display intermediary numbers from
# GRIM-testing with `show_rec = TRUE`:
pigs1 %>%
grim_map(show_rec = TRUE)
# Get summaries with `audit()`:
pigs1 %>%
grim_map() %>%
audit()
Run the code above in your browser using DataLab