Skip to contents

Canonical 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).

Usage

phylo_scalar(species, tree = NULL, vcv = NULL)

Arguments

species

Unquoted column name for the species factor.

tree

An ape::phylo object. Canonical.

vcv

A tip-only phylogenetic correlation matrix (n_species x n_species). Legacy / superseded.

Value

A formula marker; never evaluated.

Details

Pass the phylogeny via tree = phylo (canonical, sparse \(\mathbf{A}^{-1}\); Hadfield & Nakagawa 2010) or vcv = Cphy ([Superseded], dense). See phylo_latent() for the full discussion of the two paths.

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
  )
} # }