Estimates narrow-sense heritability (h²) for a single quantitative trait using a profile-likelihood variance-components approach equivalent to SOLAR Eclipse. The phenotype is inverse-normal transformed internally.
Usage
herit_vc(
trait,
grm,
data,
covs = NULL,
id_col = "IID",
label = NULL,
min_n = 80L,
ci_level = 0.95,
verbose = TRUE
)Arguments
- trait
Character string: name of the trait column in
data.- grm
Numeric matrix: the additive genetic relationship matrix for all individuals in
data, as returned bybuild_grm(). Row and column names must match the ID column ofdata.- data
Data frame containing
id_col,trait, and any covariate columns.- covs
Character vector of covariate column names, or
NULLfor an intercept-only model. Covariates are mean-centred and scaled to unit variance before fitting.- id_col
Name of the individual ID column in
data. Default"IID".- label
Optional string label for this model (used in batch output). If
NULL, defaults to"<trait>_adj"or"<trait>_unadj".- min_n
Minimum number of complete observations required to attempt estimation. Models with fewer observations return
NULLsilently. Default80.- ci_level
Confidence level for the profile-likelihood interval. Default
0.95.- verbose
Logical. Print progress to the console. Default
TRUE.
Value
A named list with elements:
labelModel label.
traitTrait name.
covariatesCovariate names joined by
"+", or"".nSample size after dropping missing values.
h2MLE of narrow-sense heritability.
seStandard error from profile-likelihood curvature (Wald).
ci_lo,ci_hiProfile-likelihood confidence interval bounds.
pvalOne-sided LRT p-value with chi-squared(1) boundary correction.
var_covariatesProportion of phenotypic variance explained by fixed-effect covariates (R² on INT-transformed phenotype).
NAfor unadjusted models. Corresponds to the "variance explained" column in Leocadio-Miguel et al. (2025).sigma2_aAdditive genetic variance (sigma²_g in SOLAR notation).
sigma2_eResidual environmental variance (sigma²_e).
Returns NULL if n < min_n or if the GRM subset is degenerate.
Details
Model: Omega = sigma2_p [h2 A + (1 - h2) I_n]
Optimisation: eigendecomposition of A followed by 1-D
profile-likelihood optimisation over h2 in (0, 1) using a coarse grid
to seed stats::optimize().
LRT: one-sided chi-squared(1) boundary correction – the null is on the boundary of the parameter space (h2 = 0), so the p-value is halved relative to a standard chi-squared test. This matches the SOLAR Eclipse convention.
CIs: derived by uniroot() on the profile log-likelihood, falling
back to a Wald interval if the root-finding fails.