boot_winter_2ht: Bootstrap Confidence Intervals for 2-HT Model Parameters

View source: R/winter_2ht_boot.R

boot_winter_2htR Documentation

Bootstrap Confidence Intervals for 2-HT Model Parameters

Description

Computes bootstrap confidence intervals for the parameters of the 2-HT model by resampling the observed data with replacement.

Usage

boot_winter_2ht(
  x,
  nboot = 1000,
  conf_level = 0.95,
  lineup_size = 6,
  method = c("percentile", "bca"),
  parallel = FALSE,
  ncpus = 2,
  seed = NULL,
  ...
)

Arguments

x

A winter_2ht object from fit_winter_2ht(), OR count data/data frame as in fit_winter_2ht().

nboot

Number of bootstrap samples. Default is 1000.

conf_level

Confidence level for intervals. Default is 0.95.

lineup_size

Lineup size (only needed if x is count data, not a winter_2ht object).

method

Type of bootstrap CI: "percentile" (default) or "bca" (bias-corrected and accelerated).

parallel

Logical indicating whether to use parallel processing. Default is FALSE.

ncpus

Number of CPUs to use if parallel = TRUE. Default is 2.

seed

Random seed for reproducibility. Default is NULL.

...

Additional arguments passed to fit_winter_2ht().

Details

The bootstrap procedure resamples within TP and TA strata with replacement to keep both experimental totals fixed. For each bootstrap sample, the 2-HT model is re-fitted, and the distribution of parameter estimates across bootstrap samples is used to construct confidence intervals.

Two types of confidence intervals are available:

  • percentile: Uses quantiles of the bootstrap distribution

  • bca: Bias-corrected and accelerated intervals (Efron, 1987). The bias correction counts bootstrap ties with the estimate as half, and the acceleration comes from the jackknife over individual observations, centered and scaled within TP/TA strata, using at most six distinct leave-one-out response-count fits.

Value

An object of class "winter_2ht_boot" containing:

boot_estimates

Matrix of bootstrap parameter estimates (nboot x 4)

ci

Matrix of confidence intervals for each parameter

original_fit

The original model fit

nboot

Number of bootstrap samples

conf_level

Confidence level used

References

Efron, B. (1987). Better bootstrap confidence intervals. Journal of the American Statistical Association, 82(397), 171-185.

Examples


counts <- c(
  n_tp_suspect = 147, n_tp_filler = 94, n_tp_reject = 141,
  n_ta_suspect = 38, n_ta_filler = 138, n_ta_reject = 206
)
fit <- fit_winter_2ht(counts, lineup_size = 6)

# Bootstrap CIs
boot_fit <- boot_winter_2ht(fit, nboot = 200, seed = 123)
print(boot_fit)
plot(boot_fit)



r4lineups documentation built on Nov. 10, 2026, 1:08 a.m.