Learn R Programming

capr (version 0.2.0)

capr.boot: Bootstrap confidence intervals for CAP coefficients

Description

Generates bootstrap inference for the CAP regression coefficients while holding the fitted directions \(\Gamma\) fixed. Each replicate samples the covariance slices \(S[, , i]\) with replacement, projects them onto the fixed directions to obtain component-specific variances, and re-solves the \(\beta^{(k)}\) equations. Quantile-based confidence intervals are returned for every predictor/component pair.

Usage

capr.boot(
  fit,
  nboot = 1000L,
  level = 0.95,
  max_iter = 100L,
  tol = 1e-06,
  seed = NULL
)

Value

A list of class capr.boot with:

beta

bootstrap average of \(\beta\) with dimension \(q \times K\)

ci_lower, ci_upper

Matrices \(q \times K\) with the lower/upper confidence limits.

level

The requested confidence level.

Arguments

fit

A capr fit containing components B and Gamma.

nboot

Integer; number of bootstrap replicates.

level

Confidence level for the returned intervals.

max_iter

Maximum Newton iterations for solving \(\beta\).

tol

Convergence tolerance for the Newton solver.

seed

Optional integer seed for reproducibility.

Examples

Run this code
simu.data <- simu.capr(seed = 123L, n = 120L)
K <- 3L
fit <- capr(
    S = simu.data$S,
    X = simu.data$X,
    K = K
)
capr.boot(fit, nboot = 10L, level = 0.95, seed = 42L)

Run the code above in your browser using DataLab