get_selected_G: Extract selected (retained) exposures from a fitted LUCID...

View source: R/model_extractors.R

get_selected_GR Documentation

Extract selected (retained) exposures from a fitted LUCID model

Description

Reads model$select$selectG (or, for a serial model, stage 1's own selection), auto-detecting the model type from class(model). Stage 1 is the only stage in a serial chain whose "G" is the cohort's actual exposures – from stage 2 on, "G" is the previous stage's posterior cluster probabilities, so there is nothing there for an exposure-selection result to describe (see estimate_lucid's @return for the full rationale). This is exactly the same field estimate_lucid() already returns; this function only adds the class-based dispatch and the union/per-layer/per-stage bookkeeping so a caller doesn't have to.

Usage

get_selected_G(model, layer = NULL)

Arguments

model

A fitted early_lucid, lucid_parallel, or lucid_serial object.

layer

For a parallel model only: which layer's own exposure selection to return (an integer index or a layer name). If NULL (the default), returns the union across layers (selected in at least one layer) – ignored for early and serial.

Value

A named logical vector, one entry per exposure, TRUE where retained.

Examples

idx <- 1:200
G <- sim_data$G[idx, ]
Z <- sim_data$Z[idx, ]
Y_normal <- sim_data$Y_normal[idx, ]
fit <- estimate_lucid(G = G, Z = Z, Y = Y_normal, lucid_model = "early",
                      family = "normal", K = 2, Rho_G = 0.1,
                      max_itr = 10, max_tot.itr = 30)
get_selected_G(fit)

LUCIDus documentation built on Sept. 3, 2026, 1:06 a.m.