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
)

Arguments

sd

The standard deviation of the distribution

n_obs

The number of observations (sample size)

mean

The mean of the distribution

min_val

The minimum value

max_val

The maximum value

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

sd_prec

The precision of the standard deviation, again only needed if reported standard deviation 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_range

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

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.

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