Learn R Programming

tcl (version 1.0.1)

opt_n: Computes the optimal sample size for item parameter invariance tests.

Description

Computes the informative sample size given an effect of interest and type I and II error probabilities (alpha and beta) for Wald (W), likelihood ratio (LR), Rao score (RS), and gradient (GR) test. The routine supports two modes: Either provide the return object of a previous call to invar_test() or provide the effect size of interest along with the degrees of freedom.

Usage

opt_n(
  invar_obj = NULL,
  effect = NULL,
  df = NULL,
  alpha = 0.05,
  beta = 0.05,
  n_range = 10:10000
)

Value

A list of two elements:

opt_n

The required sample sizes for the four tests.

real_pow

The realized power, as the sample sizes are rounded to the next integer.

call

The matched call.

Arguments

invar_obj

Return object of a previous call to invar_test(). Default is NULL. If missing, values for effect and df need to be set manually.

effect

Numeric value representing the effect size. A real number between 0 and 1, interpreted as a proportion of pseudo-variance between persons with different covariate values (but the same person parameter). Default is NULL.

df

Degrees of freedom of the test. Default is NULL.

alpha

Type I error probability. Default is 0.05.

beta

Type II error probability. Default is 0.05.

n_range

A numeric vector specifying the sample sizes to be evaluated. Default is 10:10000).

Details

The informative sample size is the number of observations realizing a score greater than zero and less than the maximum possible score, as these two values are not informative for the tests.

Providing the return object of a previous call to invar_test() allows using the results of a pilot study to obtain an empirical estimate of parameter differences between the groups.

The default search range of 10:10000 should suffice for most applications. However, if the maximum is reached, a warning is given.

If effect and df are provided, the sample sizes of all four tests will be equal due to their asymptotic equivalence. If an invar_obj is provided, the sample sizes will usually differ slightly.

Note: The invar_test() function currently only supports a two-group split.

References

Draxler, C., & Kurz, A. (2025). Testing measurement invariance in a conditional likelihood framework by considering multiple covariates simultaneously. Behavior Research Methods, 57(1), 50.

See Also

invar_test, p_curve, p_ncurve