Skip to contents

Given an mfsusie fit that has been post-smoothed via mf_post_smooth(), returns one row per (CS, outcome, contiguous-run) triple identifying the position ranges where the smoothed credible band excludes zero. Useful as a compact diagnostic for "where on the curve does this CS act on this outcome?".

Usage

mf_summarize_effects(fit, smooth_method = NULL)

Arguments

fit

an mfsusie / fsusie() fit. The fit must carry post-smoothed credible bands; call mf_post_smooth(fit, method = ...) first.

smooth_method

optional name of the smoother to read from fit$smoothed. When NULL (default) the smoother priority order is used: "TI" > "smash" > "HMM" > "scalewise".

Value

A data frame with columns

cs_index

integer, the credible-set index (1..length(fit$sets$cs_index)).

outcome

integer, the outcome index m.

start, end

integer position indices defining the contiguous run on the T_basis[m]-position grid where the band excludes zero.

n_positions

integer, run length (end - start + 1).

When no CS has any band-excludes-zero run, returns an empty data frame with the same columns.

Examples

# \donttest{
set.seed(1L)
n <- 100; p <- 20; T_m <- 32L
X <- matrix(rnorm(n * p), n)
beta <- numeric(p); beta[3] <- 1.2
shape <- exp(-((seq_len(T_m) - T_m / 2)^2) / (2 * 6^2))
Y <- X %*% (matrix(beta, p, 1) %*% matrix(shape, 1, T_m)) +
       matrix(rnorm(n * T_m, sd = 0.3), n)
fit <- fsusie(Y, X, L = 1, verbose = FALSE)
fit_s <- mf_post_smooth(fit, method = "TI")
mf_summarize_effects(fit_s)
#>   cs_index outcome start end n_positions
#> 1        1       1     1  32          32
# }