Skip to contents

Sample size for a two-group comparison of item success probabilities, the quantity a Mantel-Haenszel or logistic DIF test is powered on. Uses the normal approximation for two independent proportions with unequal group sizes.

Usage

morie_dif_sample_size(
  p_reference,
  odds_ratio = NULL,
  p_focal = NULL,
  ratio = 1,
  power = 0.8,
  alpha = 0.05
)

Arguments

p_reference

Probability of a correct or endorsed response in the reference group.

odds_ratio

Odds ratio to detect, focal relative to reference. Values below 1 mean the item is harder for the focal group. Either this or p_focal must be supplied.

p_focal

Probability in the focal group. Overrides odds_ratio when supplied.

ratio

Reference-to-focal size ratio \(n_{ref}/n_{focal}\). Default 1.

power

Target power. Default 0.8.

alpha

Two-sided significance level. Default 0.05.

Value

A list with n_focal, n_reference, n_total, p_focal, p_reference and the inputs.

Details

The practical point in subgroup work is that power is governed by the smaller group. A focal group that is a small share of the sample caps DIF detection regardless of how large the total is, so a scale can be reported as invariant simply because the analysis never had the power to find otherwise.

Examples

# Detect an odds ratio of 1.5 against a reference rate of 0.6
morie_dif_sample_size(0.6, odds_ratio = 1.5)
#> $n_focal
#> [1] 420.0423
#> 
#> $n_reference
#> [1] 420.0423
#> 
#> $n_total
#> [1] 840.0847
#> 
#> $p_focal
#> [1] 0.6923077
#> 
#> $p_reference
#> [1] 0.6
#> 
#> $odds_ratio
#> [1] 1.5
#> 
#> $ratio
#> [1] 1
#> 
#> $power
#> [1] 0.8
#> 
#> $alpha
#> [1] 0.05
#> 
# The same target when the focal group is a fifth of the sample
morie_dif_sample_size(0.6, odds_ratio = 1.5, ratio = 4)
#> $n_focal
#> [1] 265.5485
#> 
#> $n_reference
#> [1] 1062.194
#> 
#> $n_total
#> [1] 1327.742
#> 
#> $p_focal
#> [1] 0.6923077
#> 
#> $p_reference
#> [1] 0.6
#> 
#> $odds_ratio
#> [1] 1.5
#> 
#> $ratio
#> [1] 4
#> 
#> $power
#> [1] 0.8
#> 
#> $alpha
#> [1] 0.05
#>