Skip to contents

[Experimental]

Usage

genetic_covariance(object, ...)

G_matrix(object, ...)

residual_covariance(object, ...)

R_matrix(object, ...)

genetic_correlation(object, ...)

residual_correlation(object, ...)

Arguments

object

A fitted model object.

...

Reserved for future arguments.

Value

A numeric matrix for hsquared_fit objects that contain the requested multivariate result field.

Details

These extractors return the genetic (G) and residual (R) covariance or correlation matrices from multivariate hsquared_fit objects (a cbind() response). That call auto-routes on the default path, but the fitter is dense and validation-scale: it is capped by max_dense_cells (nobs^2 + nanimals^2, default 1e6; a few hundred animals at t = 2). G_matrix() is an applied-workflow alias for genetic_covariance(), and R_matrix() is an alias for residual_covariance(). Use them after checking fit_diagnostics() because likelihood-based summaries are intentionally blocked when a multivariate fit has not converged.

A fitted genetic correlation of +1 or -1 means the estimated G sat on the correlation boundary in this sample, not that the traits are known to share one genetic value. print() and summary() can still report converged = TRUE; R does not set a boundary flag for |r_g| -> 1. covariance_standard_errors() is omitted at that flat or boundary optimum.

Examples

if (FALSE) {
fit_mv <- hsquared(
  cbind(weight, length) ~ sex + age + animal(1 | id, pedigree = ped),
  data = dat,
  family = gaussian(),
  REML = TRUE,
  control = hs_control(
    engine = "julia",
    engine_control = list(target = "multivariate")
  )
)

fit_diagnostics(fit_mv)

genetic_covariance(fit_mv)
G_matrix(fit_mv)
residual_covariance(fit_mv)
R_matrix(fit_mv)
genetic_correlation(fit_mv)
residual_correlation(fit_mv)
heritability(fit_mv)
}