recommended_n: Find the Minimum Sample Size Meeting a Criterion Threshold

View source: R/recommended_n.R

recommended_nR Documentation

Description

Given a summary.irt_results() object, find the smallest sample size at which a performance criterion meets the specified threshold for each item and parameter combination.

Usage

recommended_n(object, ...)

## S3 method for class 'summary_irt_results'
recommended_n(object, criterion, threshold, param = NULL, item = NULL, ...)

Arguments

object

A summary_irt_results object from summary.irt_results().

...

Additional arguments (ignored).

criterion

Character string. Which criterion to evaluate. One of: "bias", "empirical_se", "mse", "rmse", "coverage", "mcse_bias", "mcse_mse".

threshold

Positive numeric. The threshold value the criterion must meet.

param

Optional character vector. Filter to specific parameter types (e.g., "a", "b", "b1").

item

Optional integer vector. Filter to specific item numbers.

Details

For criteria where smaller is better (bias, empirical_se, mse, rmse, mcse_bias, mcse_mse), the threshold is met when the criterion value is at or below the threshold. For bias, the absolute value is used. For coverage (where higher is better), the threshold is met when coverage is at or above the threshold.

Value

A data frame with columns:

item

Item number.

param

Parameter name.

recommended_n

Minimum sample size meeting the threshold, or NA if no tested sample size meets it.

criterion

The criterion used (echoed back for reference).

threshold

The threshold used (echoed back for reference).

See Also

summary.irt_results() for computing criteria, plot.irt_results() for visualization.

Examples


design <- irt_design(
  model = "1PL", n_items = 5,
  item_params = list(b = seq(-2, 2, length.out = 5))
)
study <- irt_study(design, sample_sizes = c(200, 500))
results <- irt_simulate(study, iterations = 10, seed = 42)
s <- summary(results)

# Minimum N for RMSE <= 0.20 on all items
recommended_n(s, criterion = "rmse", threshold = 0.20)

# Minimum N for 95% coverage on difficulty parameters only
recommended_n(s, criterion = "coverage", threshold = 0.95, param = "b")



irtsim documentation built on April 24, 2026, 1:07 a.m.