A convenience wrapper around herit_vc() that iterates over a vector of
trait names, optionally across multiple covariate models, and returns a
tidy data frame.
herit_batch(
traits,
grm,
data,
covs_list = NULL,
id_col = "IID",
min_n = 80L,
ci_level = 0.95,
.progress = TRUE
)Character vector of trait column names in data.
Numeric matrix: additive genetic relationship matrix as returned
by build_grm().
Data frame containing ID, trait, and covariate columns.
A named list of covariate vectors, where each element
defines one covariate model. If NULL, a single unadjusted model is run.
Example: list(unadj = NULL, cov1 = c("age", "sex"), cov2 = c("age", "sex", "age2")).
Name of the individual ID column. Default "IID".
Minimum sample size to attempt estimation. Default 80.
Profile-likelihood CI level. Default 0.95.
Logical. Show a cli progress bar. Default TRUE.
A data frame (tibble-compatible) with one row per successfully
fitted model and columns: label, trait, covariates, n, h2,
se, ci_lo, ci_hi, pval, sigma2_a, sigma2_e.
Failed / skipped models are silently omitted.
if (FALSE) { # \dontrun{
A <- build_grm(my_pedigree, study_ids = my_data$IID)
res <- herit_batch(
traits = c("bmi", "systolic_bp", "hdl"),
grm = A,
data = my_data,
covs_list = list(
unadj = NULL,
cov1 = c("age", "sex"),
cov2 = c("age", "sex", "age2")
)
)
# Significant adjusted models
subset(res, grepl("cov2", label) & pval < 0.05)
} # }