grim_grid: GRIM results on a grid of sample sizes and means

View source: R/grim-grid.R

grim_gridR Documentation

GRIM results on a grid of sample sizes and means

Description

[Experimental]

grim_grid() tests every combination of sample size and fractional part of a mean with GRIM, for one number of decimal places and one rounding method. It is meant for studying GRIM's properties directly. grim_plot_grid() draws the inconsistent cells as its background raster.

Usage

grim_grid(digits_x, data_type, rounding = "up_or_down", threshold = 5)

Arguments

digits_x

Integer. Number of decimal places, from 1 to 3.

data_type

String. "integer" if the values are whole numbers, as in grim(). Under "continuous", every cell is consistent, and under NA, the inconsistent ones are NA.

rounding, threshold

The same as in grim().

Details

The grid covers sample sizes from 1 to 10^digits_x, where GRIM stops ruling out any mean, and fractional parts in steps of 1 / 10^digits_x, without zero. All fractional parts of means are positive, so there is no symmetric argument.

For percentages, use the number of decimal places of the proportion, which is two more: grim_grid(2) for whole percentages, as in grim_map() with x_meaning = "percentage".

Grids for one or two decimal places are precomputed for every rounding method that has no threshold. All others are computed on demand, which takes some 20 to 30 seconds for three decimal places. Four or more would mean a grid of 100 million cells, so digits_x is at most 3.

Value

A tibble with one row per cell of the grid and the columns frac (the fractional part of a mean), n (the sample size), and consistency (the GRIM result).

Examples

grim_grid(digits_x = 1, data_type = "integer")

# Share of means ruled out per sample size:
grim_grid(digits_x = 2, data_type = "integer") |>
  dplyr::summarise(share_inconsistent = mean(!consistency), .by = n)

scrutiny documentation built on Nov. 11, 2026, 1:09 a.m.