
Independent per-trait animal-model random intercepts: animal_indep(0 + trait | id)
Source: R/animal-keyword.R
animal_indep.RdPer-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().
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;TRUEties 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-deprecatedanimal_scalar(id).- rho
Source strength: a number in
[0,1]fixesrho * K + (1-rho) * diag(diag(K))on the legacy-resolved source scale. Omitted or explicit1preserves the existing model.NULLestimates 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{
# 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, unit = "species", family = gaussian()
)
} # }