Skip to contents

Per-trait animal-model random intercepts with no cross-trait covariance, using the bar-form syntax; the .indep marker disambiguates printing. Mathematical parallel to phylo_indep().

Usage

animal_indep(formula, pedigree = NULL, A = NULL, Ainv = NULL, common = FALSE)

Arguments

formula

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

pedigree, A, Ainv

See animal_scalar().

common

FALSE (default) for a separate additive-genetic variance per trait; TRUE ties all traits to one shared additive-genetic variance (intercept-only). animal_indep(0 + trait | id, common = TRUE) is the canonical one-shared-variance spelling and fits the same model as the soft-deprecated animal_scalar(id).

Value

See animal_scalar().

See also

Examples

if (FALSE) { # \dontrun{
# Independent per-trait animal-model intercepts via the bar form,
# passing the dense relatedness matrix A directly.
# 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_indep(0 + trait | species, A = A),
  data = df, family = gaussian()
)
} # }