ltg_smd_ci: Compute confidence intervals for the LTG-SMD

View source: R/ltg_smd_ci.R

ltg_smd_ciR Documentation

Compute confidence intervals for the LTG-SMD

Description

Computes one or more confidence intervals for the LTG-SMD, including the analytic delta-method interval (reliability-fixed; Section 4.2 of the paper) and the bias-corrected (BC) or bias-corrected-and-accelerated (BCa) nonparametric bootstrap interval.

Usage

ltg_smd_ci(
  object,
  method = c("analytic", "bootstrap"),
  boot_type = c("bc", "bca", "percentile"),
  B = 2000,
  level = 0.95,
  seed = NULL,
  parallel = c("no", "multicore", "snow"),
  ncpus = 1L,
  study_data = NULL,
  reference_data = NULL,
  group_var = NULL,
  score_var = NULL,
  items = NULL,
  group_levels = NULL,
  reliability_estimator = "alpha",
  rho_external = NULL
)

Arguments

object

An object of class "ltg_smd" returned by compute_ltg_smd().

method

Character vector with elements from c("analytic", "bootstrap"). Both can be requested.

boot_type

Character. Type of bootstrap interval: "bc" (bias-corrected, default), "bca" (bias-corrected and accelerated), or "percentile" (uncorrected percentile interval).

B

Integer. Number of bootstrap replicates. Default 2000.

level

Numeric. Confidence level, default 0.95.

seed

Optional integer for reproducibility of the bootstrap.

parallel

Character; passed to boot::boot(). Default "no".

ncpus

Integer; passed to boot::boot() if parallel != "no".

study_data

Data frame. Required for bootstrap (the original study sample passed to compute_ltg_smd).

reference_data

Data frame. Required for bootstrap.

group_var, score_var, items, group_levels, reliability_estimator

Same as in compute_ltg_smd(); required when bootstrap is requested.

rho_external

Optional; see compute_ltg_smd().

Details

Stratification. The bootstrap resamples within the four strata defined by the cross-classification of source (study vs reference) and experimental group (focal vs reference). This preserves the sample sizes of all four study x group cells across replicates, which is the appropriate stratification for a two-group LTG-SMD analysis. Earlier versions of this package stratified only on source; that design allowed the group-1/group-0 ratio within each source to vary across replicates, producing unstable confidence intervals under small samples or unequal group sizes.

Reliability propagation. Because the bootstrap recomputes the entire LTG-SMD plug-in within each replicate, item-level reliability is re-estimated each time (when items is supplied). This propagates uncertainty in the reliability estimator through to the interval. By contrast, the analytic interval treats reliability as fixed at its point estimate.

Value

An object of class "ltg_smd_ci" containing:

analytic

Named numeric vector with elements estimate, lower, upper, se, level.

bootstrap

Named numeric vector with bootstrap interval, or NULL if bootstrap not requested.

boot_details

If bootstrap requested, list with B, type, seed, z0, acceleration, strata_design, and the bootstrap distribution.

Examples

set.seed(2026)
gen_items <- function(n, shift = 0) {
  true <- rnorm(n)
  data.frame(
    item1 = true + rnorm(n, sd = 0.6) + shift,
    item2 = true + rnorm(n, sd = 0.6) + shift,
    item3 = true + rnorm(n, sd = 0.6) + shift,
    item4 = true + rnorm(n, sd = 0.6) + shift
  )
}
study_df <- rbind(
  cbind(condition = "control",   gen_items(15)),
  cbind(condition = "treatment", gen_items(15, shift = 0.5))
)
reference_df <- rbind(
  cbind(condition = "control",   gen_items(30)),
  cbind(condition = "treatment", gen_items(30, shift = 0.5))
)
result <- compute_ltg_smd(study_df, reference_df,
  group_var = "condition", items = c("item1", "item2", "item3", "item4"),
  group_levels = c(reference = "control", focal = "treatment"))

# B is kept small here so the example runs quickly; in practice use a
# larger B (e.g. 2000, the default) for stable bootstrap intervals.
ci <- ltg_smd_ci(result,
  method = c("analytic", "bootstrap"),
  B = 200, seed = 20260814,
  study_data = study_df, reference_data = reference_df,
  group_var = "condition", items = c("item1", "item2", "item3", "item4"),
  group_levels = c(reference = "control", focal = "treatment"))
print(ci)

ltgsmd documentation built on Sept. 27, 2026, 5:07 p.m.