Skip to contents

Package

arfun arfun-package
arfun: Ancestral Reconstruction of the Fundamental Niche

Preparing data

From occurrence points and a shared accessible area to the data blocks consumed by the joint models.

prepare_niche_data()
Prepare niche data for Stan
prepare_phylo_data()
Prepare phylogenetic data for evolutionary models
prepare_phylo_niche_data()
Prepare joint phylogenetic niche data for evolutionary models
shared_background_sample()
Draw one shared background sample for a clade

MAP estimation and diagnostics

The math-scale log-posterior, its compiled C++ backend, multistart optimization and boundary diagnostics for poorly identified niches.

niche_logpost()
Joint phylo-niche log-posterior on the unconstrained scale
niche_logpost_xptr()
Compiled C++ objective for the phylo-niche log-posterior
niche_logpost_eval_xptr()
Evaluate the compiled phylo-niche log-posterior
niche_theta_layout()
Parameter layout of the phylo-niche objective
niche_empirical()
Empirical per-species niche moments
niche_start_ranges()
Data-driven start ranges for the phylo-niche objective
niche_multistart()
Multi-start MAP optimization of the joint phylo-niche posterior
niche_boundary_report()
Per-species boundary diagnostics at a fitted point
niche_warmstart()
Per-species warm-start for the joint phylo-niche objective

Bayesian fitting

Stan models and posterior extraction for niche evolution.

compile_model()
Compile a Stan model for the fundamental niche
model_path()
Get path to a Stan model file
fit_niche()
Fit a Bayesian presence-only niche model
fit_evolution()
Fit an evolutionary model for niche parameters
extract_pars()
Extract niche parameters from a fitted presence-only model
extract_evolution_pars()
Extract evolutionary parameters from a fitted model
stan_only()
Keep only the fields a Stan model declares
niche_overlap()
Compare niche overlap between two ancestral states

Projection and virtual species

Project niches to geography and simulate virtual clades for reverse-engineering benchmarks.

probability_detection()
Probability of detection under the ellipsoidal niche model
virtual_species_occurrences()
Sample occurrence points for a virtual species
simulate_niche_evolution()
Simulate niche evolution along a phylogeny
project_single_niche()
Generate suitability raster for a single niche state
project_ancestral_niche()
Project supplied niche states to geographic space