Skip to contents

Uses BACE to provide a phylogenetically-informed Bayesian baseline for all trait types. Returns imputed means and between-imputation SEs in latent scale, matching the interface of fit_baseline.

Usage

fit_baseline_bace(
  data,
  tree,
  splits = NULL,
  runs = 5L,
  nitt = 4000L,
  burnin = 1000L,
  thin = 10L,
  verbose = TRUE
)

Arguments

data

object of class "pigauto_data".

tree

object of class "phylo".

splits

list (output of make_missing_splits) or NULL.

runs

integer. Number of BACE chained imputation iterations (default 5L).

nitt

integer. MCMC iterations per model (default 4000L).

burnin

integer. Burn-in iterations (default 1000L).

thin

integer. Thinning rate (default 10L).

verbose

logical.

Value

A list with:

mu

Numeric matrix (n x p_latent), baseline means.

se

Numeric matrix (n x p_latent), between-imputation SEs.

Details

BACE runs chained MCMCglmm imputation: each trait is modelled as a response with all others as predictors, cycling through multiple MCMC runs. This provides a fully phylogenetic baseline for binary, categorical, and count traits — not just continuous ones.

The returned mu matrix is the mean across imputation runs; se is the between-imputation SD (capturing imputation uncertainty). Both are in latent scale (same as pigauto_data$X_scaled), so they can be passed directly to fit_pigauto as the baseline argument.

Examples

if (FALSE) { # \dontrun{
bl_bace <- fit_baseline_bace(pd, tree, splits = spl)
fit <- fit_pigauto(pd, tree, splits = spl, baseline = bl_bace)
} # }