Skip to contents

Full-rank unstructured \(T \times T\) additive-genetic covariance matrix \(\boldsymbol G\), parameterised as the Cholesky factor of a rank-\(T\) \(\boldsymbol\Lambda\) (i.e. the animal_latent() case with \(K = T\)). Mathematical parallel to phylo_dep().

Usage

animal_dep(formula, pedigree = NULL, A = NULL, Ainv = NULL, rho = 1)

Arguments

formula

An lme4-bar formula of the form 0 + trait | id.

pedigree, A, Ainv

See animal_scalar().

rho

Source strength: a number in [0,1] fixes rho * K + (1-rho) * diag(diag(K)) on the legacy-resolved source scale. Omitted or explicit 1 preserves the existing model. NULL estimates strength for one Gaussian structured trait-intercept block with complete replicated multivariate observations and no competing ordinary covariance. Estimated latent terms require rank one and at least four traits. The same strength applies to the entire latent-plus-Psi covariance. This parameter is not a variance-share summary. Fixed attenuation and the admitted Gaussian estimator have implementation checks; recovery is regime-specific.

Value

See animal_scalar().

Examples

if (FALSE) { # \dontrun{
# Full unstructured additive-genetic trait covariance (rank = n_traits).
# Grounded in test-animal-keyword.R.
ped <- data.frame(
  id   = paste0("i", 1:12),
  sire = c(rep(NA, 4), rep(c("i1", "i2"), length.out = 8)),
  dam  = c(rep(NA, 4), rep(c("i3", "i4"), length.out = 8))
)
A <- pedigree_to_A(ped)
yvec <- as.numeric(MASS::mvrnorm(
  1, mu = rep(0, 2 * 12),
  Sigma = kronecker(diag(2), A) * 0.5 + diag(2 * 12) * 0.5
))
df <- data.frame(
  species = factor(rep(ped$id, each = 2), levels = ped$id),
  trait   = factor(rep(c("t1", "t2"), times = 12), levels = c("t1", "t2")),
  value   = yvec
)
fit <- gllvmTMB(
  value ~ 0 + trait + animal_dep(0 + trait | species, A = A),
  data = df, unit = "species", family = gaussian()
)
} # }