Skip to contents

For each latent effect (column) in a posterior model probability matrix pmp, select the smallest set of variables whose cumulative probability reaches at least coverage. Optionally filter out sets whose minimum absolute pairwise correlation (from Rmat) is below cor_threshold, and remove duplicates.

Usage

confidence_set(pmp, kept, coverage = 0.95, Rmat = NULL, cor_threshold = 0.5)

Arguments

pmp

Numeric matrix of dimension \(p \times L\), where each column sums to 1 and contains posterior inclusion probabilities for each variable and effect.

kept

Logical vector of length \(L\), indicating which effects (columns) to process.

coverage

Numeric scalar in [0,1], the target cumulative probability for a confidence set. Defaults to 0.95.

Rmat

Optional \(p \times p\) numeric correlation matrix for the predictors. If supplied, any set whose minimum off-diagonal absolute correlation is below cor_threshold is discarded. Defaults to NULL.

cor_threshold

Numeric scalar in [0,1], the minimum absolute correlation allowed within a set to pass the correlation filter. Defaults to 0.5.

Value

A list with components:

sets

A named list of integer vectors. Each element cs1, cs2, … is a confidence set of variable indices that achieves the target coverage. If no sets survive the filters, sets is NULL.

claimed

Numeric vector of the actual cumulative probabilities ("claimed coverage") for each returned set.

Examples

# Simple two-effect example
pmp <- matrix(c(0.6, 0.3, 0.1,
                0.2, 0.5, 0.3),
              nrow = 3, byrow = FALSE)
kept <- c(TRUE, TRUE)
cs <- confidence_set(pmp, kept)

# With a correlation filter
Rmat <- cor(matrix(rnorm(9), nrow = 3))
cs2 <- confidence_set(pmp, kept, coverage = 0.8, Rmat = Rmat, cor_threshold = 0.2)