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).
GRIM_test(
mean,
n_obs,
m_prec = NULL,
n_items = 1,
return_values = FALSE,
return_list = FALSE,
quiet = FALSE
)
The mean of the distribution
The number of observations (sample size)
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
Number of items in scale, if distribution represents scale averages. Defaults to 1, which represents any single-item measure.
A logical value. ignored if return_list = TRUE
.
If FALSE
(the default), the function
returns a simple TRUE
or FALSE
. If TRUE
, it returns a numeric
vector of all possible means that are consistent with the parameters.
If the test fails when return_values = TRUE
, a warning is issued and
the closest consistent mean is returned. If there are two equally close
means, both are returned.
A logical value. If FALSE
(the default), the function's
return type is determined by return_values
. If TRUE
, the function
instead returns a list containing two elements: a logical passed
flag
and a numeric vector values
containing the relevant means.
Suppress warnings.
The return type depends on the arguments. By default, a logical scalar
(TRUE
or FALSE
). If return_values = TRUE
, a numeric vector is returned.
If return_list = TRUE
, a list is returned.
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.
# A sample of 28 integers cannot result in a mean of 5.19.
GRIM_test(mean = 5.19, n_obs = 28)
#> [1] FALSE
# To find the closest possible mean, set return_values to TRUE
GRIM_test(mean = 5.19, n_obs = 28, return_values = TRUE)
#> Warning: Mean 5.19 fails GRIM test - closest consistent value: 5.18
#> [1] 5.18
# To get a detailed list containing both the logical result and the values
GRIM_test(mean = 5.19, n_obs = 28, return_list = TRUE)
#> $passed
#> [1] FALSE
#>
#> $values
#> [1] 5.18
#>