grim_map {scrutiny}R Documentation

GRIM-test many cases at once

Description

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.

Usage

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
)

Arguments

data

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

items

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.

merge_items

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.

percent

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.

x, n

Optionally, specify these arguments as column names in data.

show_rec

Logical. If set to TRUE, the reconstructed numbers from GRIM-testing are shown as columns. See section Reconstructed numbers below. Default is FALSE.

show_prob

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.

rounding, threshold, symmetric, tolerance

Further parameters of GRIM-testing; see documentation for grim().

testables_only

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.

extra

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.

Value

A tibble with these columns –

Reconstructed numbers

If show_rec is set to TRUE, the output includes the following additional columns:

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

Summaries with audit()

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 –

  1. incons_cases: number of GRIM-inconsistent value sets.

  2. all_cases: total number of value sets.

  3. incons_rate: proportion of GRIM-inconsistent value sets.

  4. mean_grim_ratio: average of GRIM ratios.

  5. incons_to_ratio: ratio of incons_rate to mean_grim_ratio.

  6. testable_cases: number of GRIM-testable value sets (i.e., those with a positive ratio).

  7. testable_rate: proportion of GRIM-testable value sets.

References

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

Examples

# 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()

[Package scrutiny version 0.4.0 Index]