Package: pigauto 0.10.0

pigauto: Fill in Missing Species Traits Using a Phylogenetic Tree

Imputes missing species trait data for comparative analyses by combining three sources of information: phylogenetic similarity (closely related species share similar traits), cross-trait correlations (observed traits inform missing ones), and optional environmental covariates (climate, habitat, geography). Handles continuous measurements, counts, binary variables, ordered categories, unordered categories, bounded proportions, zero-inflated counts, and compositional multi-proportion data in a single call. The method blends a phylogenetic baseline with a graph neural network correction; a per-trait gate calibrated on held-out data ensures the network only contributes when it improves on the baseline. Provides conformal prediction intervals for continuous, count, and ordinal traits and an experimental analysis-aware multiple-imputation workflow for one missing continuous covariate in Gaussian linear, binomial-logit, and Gaussian random-intercept models, with Rubin pooling limited to fixed effects. Stochastic graph-network and posterior-tree completions are prediction diagnostics rather than validated inferential imputations. Tested up to 10,000 species. Bundled datasets include 300-species and 9,993-species bird-trait subsets with matching example phylogenetic trees. Rubin (1987, ISBN:978-0-471-08705-2); Vovk et al. (2005, ISBN:978-0-387-25061-8); Nakagawa and de Villemereuil (2019) <doi:10.1093/sysbio/syy089>.

Authors:Shinichi Nakagawa [aut, cre, cph]

pigauto_0.10.0.tar.gz
pigauto_0.10.0.zip(r-4.7)pigauto_0.10.0.zip(r-4.6)pigauto_0.10.0.zip(r-4.5)
pigauto_0.10.0.tgz(r-4.6-any)pigauto_0.10.0.tgz(r-4.5-any)
pigauto_0.10.0.tar.gz(r-4.7-any)pigauto_0.10.0.tar.gz(r-4.6-any)
pigauto_0.10.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
pigauto/json (API)

# Install 'pigauto' in R:
install.packages('pigauto', repos = c('https://itchyshin.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/itchyshin/pigauto/issues

Pkgdown/docs site:https://itchyshin.github.io

Datasets:
  • avonet_full - Full AVONET morphological and ecological trait data for 9,993 bird species
  • avonet300 - AVONET morphological and ecological trait data for 300 bird species
  • ctmax_sim - Simulated multi-observation-per-species CTmax data
  • tree_full - Example bird phylogeny for the species in 'avonet_full'
  • tree300 - Example bird phylogeny for the 300 species in 'avonet300'
  • trees300 - 50 posterior phylogenies for the 300 species in 'avonet300'

On CRAN:

Conda:

5.87 score 3 stars 62 scripts 31 exports 35 dependencies

Last updated from:0cc11c5a0d (on main). Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK289
source / vignettesOK326
linux-release-x86_64OK245
macos-release-arm64OK132
macos-oldrel-arm64OK151
windows-develOK200
windows-releaseOK181
windows-oldrelOK197
wasm-releaseOK169

Exports:build_phylo_graphcalibration_dfcompare_methodsconfusion_matrixcross_validateevaluateevaluate_imputationfit_baselinefit_pigautoimputeload_pigautomake_missing_splitsmask_missingmulti_imputemulti_impute_analysismulti_impute_treespigauto_reportplot_comparisonplot_history_ggplot_uncertaintypool_mipreprocess_traitspull_gbif_centroidspull_worldclim_per_speciesread_traitsread_treesave_pigautosimulate_benchmarksimulate_non_bmsuggest_next_observationwith_imputations

Dependencies:apebitbit64callrclicorocpp11descdigestfarverggplot2gluegtableisobandjsonlitelabelinglatticelifecyclemagrittrMatrixnlmeotelprocessxpsR6RColorBrewerRcpprlangS7safetensorsscalestorchvctrsviridisLitewithr

Getting started with pigauto
What pigauto does | How it works (briefly) | Installation | Quick start | The AVONET bird data | Step 1: Preprocess | Step 2: Create evaluation splits | Step 3: Fit the BM baseline | Step 4: Build the phylogenetic graph | Step 5: Train the model | Step 6: Predict | Step 7: Evaluate and compare baselines | Step 8: Visualise | Training history | Uncertainty ribbons | Experimental analysis-aware multiple imputation | Phylogenetic tree uncertainty | Active imputation: where to measure next | Optional advanced features | Phylogenetic-signal gating | Assembling covariates from public data | Tips and next steps | References

Last update: 2026-07-11
Started: 2026-04-06

GNN architecture and the math behind pigauto
1. End-to-end data flow | 2. The phylogenetic baseline | 2.1 Continuous, count, ordinal, proportion: Brownian motion | 2.2 Binary and categorical: phylogenetic label propagation (LP) | 2.3 Joint MVN baseline (Phase 2) | 2.4 Threshold-joint baseline (Phase 3) | 2.5 OVR categorical (Phase 6) | 2.6 Multi-obs aggregation (Phase 10 + B1 soft) | 3. The GNN: ResidualPhyloDAE | 3.1 Encoder | 3.2 Graph Transformer Block (Phase 9 + B2) | 3.3 Decoder and the gate | 3.4 Loss and three safety regularisations | 3.5 Within-row cross-trait attention (B3, v0.9.3, opt-in) | 4. Calibration: making the gate a real safety floor | 5. Uncertainty quantification | 6. Posterior-tree prediction sensitivity | 7. Putting it together: a worked predictive equation | 8. Where to look in the code | References

Last update: 2026-07-11
Started: 2026-05-18

Mixed-Type Trait Imputation
Overview | Synthetic example | Preprocessing | Creating splits | Baseline fitting | Training | Prediction and decoding | Evaluation | Experimental analysis-aware multiple imputation

Last update: 2026-07-11
Started: 2026-04-07

Posterior-Tree Prediction Sensitivity
Scope | Prediction-sensitivity workflow | Why share_gnn = TRUE preserves tree signal | What this does not establish | References

Last update: 2026-07-11
Started: 2026-04-18

Common pitfalls / FAQ
1. "I called impute() and result$prediction$imputed looks like my input" | 2. "My ordinal trait predicted 100 % majority class" | 3. "The gate stays closed and the GNN seems to do nothing" | 4. "How do I know if my dataset has enough phylogenetic signal?" | 5. "Predictions are way bigger than anything I observed"

Last update: 2026-05-12
Started: 2026-05-10

Readme and manuals

Help Manual

Help pageTopics
Full AVONET morphological and ecological trait data for 9,993 bird speciesavonet_full
AVONET morphological and ecological trait data for 300 bird speciesavonet300
Build a phylogenetic graph representation from a treebuild_phylo_graph
Compute calibration data for probability predictionscalibration_df
Compare BM baseline and pigauto methods across replicatescompare_methods
Compute a confusion matrix for categorical or binary predictionsconfusion_matrix
k-fold cross-validation for pigauto trait imputationcross_validate
Simulated multi-observation-per-species CTmax datactmax_sim
Evaluate a fitted pigauto model on its test setevaluate
Evaluate imputation performance against known valuesevaluate_imputation
Fit the phylogenetic baselinefit_baseline
Fit a pigauto model for trait imputationfit_pigauto
Impute missing phylogenetic traits (convenience wrapper)impute
Load a saved pigauto modelload_pigauto
Split cells into train/val/test for imputation evaluationmake_missing_splits
Create an observed/missing mask matrixmask_missing
Generate experimental stochastic completion datasetsmulti_impute
Analysis-aware multiple imputation for narrow regression modelsmulti_impute_analysis
Posterior-tree prediction sensitivitymulti_impute_trees
Generate an HTML benchmark report from a pigauto fitpigauto_report
Forest-plot style comparison of benchmark resultsplot_comparison
Plot training history (ggplot2, deprecated)plot_history_gg
Plot uncertainty ribbons for imputed trait valuesplot_uncertainty
Plot a pigauto benchmarkplot.pigauto_benchmark
Plot diagnostics for a fitted pigauto modelplot.pigauto_fit
Plot predictions from a pigauto modelplot.pigauto_pred
Pool downstream model fits across multiple imputations (Rubin's rules)pool_mi
Impute missing traits using a fitted pigauto modelpredict.pigauto_fit
Preprocess trait data: align to tree, encode into latent spacepreprocess_traits
Fetch species range-centroid covariates from GBIFpull_gbif_centroids
Fetch per-species bioclim covariates from WorldClim v2.1pull_worldclim_per_species
Read trait data from a CSV file or data frameread_traits
Read a phylogenetic tree from a fileread_tree
Save a fitted pigauto modelsave_pigauto
Run a simulation benchmark for pigautosimulate_benchmark
Simulate non-BM trait data for benchmarkingsimulate_non_bm
Suggest which cell to observe next to maximise imputation precisionsuggest_next_observation
Summary method for pigauto_fit objectssummary.pigauto_fit
Example bird phylogeny for the species in 'avonet_full'tree_full
Example bird phylogeny for the 300 species in 'avonet300'tree300
50 posterior phylogenies for the 300 species in 'avonet300'trees300
Fit a downstream model on every imputed datasetwith_imputations