
Single-shared-variance phylogenetic random effect: phylo_scalar(species)
Source: R/brms-sugar.R
phylo_scalar.RdCanonical name for the single-scalar (per-trait) phylogenetic random
intercept. Each trait carries an independent length-n_species draw
\(\mathbf p_t \sim \mathcal{N}(\mathbf{0}, \sigma^{2}_{\text{phy}}\,\mathbf{C}_{\text{phy}})\)
with one shared scaling \(\sigma^{2}_{\text{phy}}\) across all
traits. Formerly phylo(species) – same engine, new name. Compare to
phylo_unique() (D independent variances) and phylo_latent()
(K-dim factor decomposition).
Arguments
- species
Unquoted column name for the species factor.
- tree
An
ape::phyloobject. Canonical.- vcv
A tip-only phylogenetic correlation matrix (
n_species x n_species). Legacy / superseded.
Details
Pass the phylogeny via tree = phylo (canonical, sparse \(\mathbf{A}^{-1}\);
Hadfield & Nakagawa 2010) or vcv = Cphy
(, dense). See
phylo_latent()
for the full discussion of the two paths.
See also
phylo_unique(), phylo_latent(), phylo_indep(),
phylo_dep(), phylo() (deprecated alias).
Examples
if (FALSE) { # \dontrun{
tree <- ape::rcoal(8); tree$tip.label <- paste0("sp", seq_len(8))
sim <- simulate_site_trait(
n_sites = 1, n_species = 8, n_traits = 3,
mean_species_per_site = 8,
Cphy = ape::vcv(tree, corr = TRUE),
sigma2_phy = rep(0.3, 3), seed = 1
)
sim$data$species <- factor(sim$data$species, levels = tree$tip.label)
fit <- gllvmTMB(
value ~ 0 + trait + phylo_scalar(species),
data = sim$data, phylo_tree = tree
)
} # }