This function tests whether a given mean (with a specific precision) can result from a sample of a given size based on integer responses to one or more items. The test is based on Brown & Heathers (2017). If return_values = TRUE and if there is more than one precise mean compatible with the given parameters, all possible means are returned. In that case, if the given mean is not consistent, the closest consistent mean is returned with a warning.

GRIM_test(mean, n_obs, m_prec = NULL, n_items = 1, return_values = FALSE)

Arguments

mean

The mean of the distribution

n_obs

The number of observations (sample size)

m_prec

The precision of the mean, as number of digits after the decimal point. If not provided, taken based on the significant digits of mean - so only needed if reported mean ends in 0

n_items

Number of items in scale, if distribution represents scale averages. Defaults to 1, which represents any single-item measure.

return_values

Should all means consistent with the given parameters be returned?

Value

Either TRUE/FALSE, or all possible means (if test passes)/closest consistent mean (if test fails)

References

Brown NJ, Heathers JA (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.

Examples

# A sample of 28 integers cannot result in a mean of 5.19. This is shown by
GRIM_test(5.19, 28)
#> [1] FALSE

# To find the closest possible mean, set return_values to TRUE
GRIM_test(5.19, 28, return_values = TRUE)
#> Warning: Mean 5.19 fails GRIM test - closest consistent value: 5.18
#> [1] 5.18