This function tests whether a given standard deviation is within the range that is theoretically possible for a given sample size and mean, assuming responses are bounded by a minimum and maximum scale value. It provides a simple TRUE/FALSE check. Note that SDs within this range may still be impossible due to their granularity, so for samples where the sample size (x number of items) is below 10 to the power of the precision of the reported SD, this should only be a precursor to GRIMMER_test()

boundary_test(
  sd,
  n_obs,
  mean,
  min_val,
  max_val,
  m_prec = NULL,
  sd_prec = NULL,
  n_items = 1,
  return_range = FALSE,
  quiet = FALSE
)

Arguments

sd

The standard deviation of the distribution

n_obs

The number of observations (sample size), an integer of at least two for reconstruction.

mean

The mean of the distribution

min_val

The minimum value

max_val

The maximum value

m_prec

The precision of the reported mean, as a nonnegative integer number of decimal places (at most 308), consistent with the supplied value. Inferred from the numeric value if omitted; specify it explicitly when the reported mean ends in zero.

sd_prec

The precision of the reported standard deviation, with the same requirements as m_prec. Specify it explicitly to preserve trailing zeroes.

n_items

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

return_range

(Optional) If TRUE, the function returns a numeric vector with the SD possible range.

quiet

Suppress warnings.

Value

Logical TRUE if the standard deviation is within the possible range, and FALSE otherwise, unless return_range, in which case a numeric vector with the lower and upper bounds of the possible SD range is returned. If the range is undefined, return_range = TRUE returns two numeric NA values. Scale endpoints must be integers; multi-item averages have spacing 1 / n_items.

Examples


# For a 7-point scale with N = 20 and Mean = 4, an SD of 1.5 is within the possible range
boundary_test(sd = 1.5, n_obs = 20, mean = 4, min_val = 1, max_val = 7)
#> [1] TRUE
# but an SD of 3.5 is not possible
boundary_test(sd = 3.5, n_obs = 20, mean = 4, min_val = 1, max_val = 7)
#> [1] FALSE