pridit_boot: Bootstrap confidence intervals for PRIDIT scores and weights

View source: R/pridit_boot.R

pridit_bootR Documentation

Bootstrap confidence intervals for PRIDIT scores and weights

Description

Resamples observations with replacement B times, refitting the full PRIDIT pipeline on each resample. Returns percentile confidence intervals for every indicator weight and, optionally, for every observation's score.

Usage

pridit_boot(fit, data, B = 500L, conf_level = 0.95, scores = TRUE, seed = NULL)

Arguments

fit

A "pridit" object from pridit.

data

The same data frame that was passed to pridit().

B

Integer. Number of bootstrap replicates. Default 500.

conf_level

Numeric in (0, 1). Coverage probability. Default 0.95.

scores

Logical. If TRUE (default), also compute CIs for per-observation scores (slower for large n).

seed

Optional integer random seed for reproducibility.

Details

Because PCA sign is arbitrary, each bootstrap replicate's weight vector is aligned to the original fit before aggregation: if the Pearson correlation between the replicate weights and the original weights is negative, the replicate is sign-flipped.

Value

An object of class "pridit_boot", a list with components:

weights_ci

Data frame with columns indicator, estimate, lower, upper.

scores_ci

Data frame with columns id, estimate, lower, upper (or NULL if scores = FALSE).

B

Number of replicates used.

conf_level

Coverage probability.

call

Matched call.

See Also

pridit, autoplot.pridit_boot

Examples

dat <- data.frame(
  id = letters[1:30],
  x1 = runif(30), x2 = runif(30), x3 = runif(30)
)
fit  <- pridit(dat)
boot <- pridit_boot(fit, dat, B = 100, seed = 42)
boot


pridit documentation built on May 31, 2026, 5:07 p.m.