| fs_assert_membership | R Documentation |
Integrity check for fs_export_maxeff_family(): the materialized membership
column of the selected candidate must equal, row for row, the per-subject
membership forestsearch itself computed
(fit$grp.consistency$sg.harm.id). A mismatch means the label-to-dummy
reconstruction is wrong, so this stops with an error rather than letting a
silently different subgroup be de-biased. fs_to_guohe() runs this check by
default (verify = TRUE).
fs_assert_membership(exp, fit)
exp |
The list returned by |
fit |
The |
TRUE, invisibly, if the memberships agree; otherwise an error is
thrown.
fs_export_maxeff_family(), fs_to_guohe()
set.seed(11)
n <- 200
df <- data.frame(id = seq_len(n), treat = rbinom(n, 1, 0.5),
age = round(rnorm(n, 55, 12)),
bm = factor(rbinom(n, 1, 0.5)))
harm <- df$age <= 50 & df$bm == "1"
tt <- rexp(n, 0.05 * exp(log(2.5) * df$treat * harm))
df$time <- pmin(tt, 60)
df$event <- as.integer(tt <= 60)
fit <- forestsearch(
df.analysis = df,
outcome.name = "time", event.name = "event",
treat.name = "treat", id.name = "id",
confounders.name = c("age", "bm"),
sg_focus = "maxeff", use_grf = FALSE, use_lasso = FALSE,
fs.splits = 50, n.min = 30, d0.min = 5, d1.min = 5,
hr.threshold = 1.1, hr.consistency = 1.0,
pconsistency.threshold = 0.5, maxk = 2,
details = FALSE, plot.sg = FALSE,
parallel_args = list(plan = "sequential", workers = 1L,
show_message = FALSE)
)
exp_fam <- fs_export_maxeff_family(fit)
fs_assert_membership(exp_fam, fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.