Package: tulpaObs 0.6.1

tulpaObs: Bayesian Occupancy, Abundance and Detection Models via 'tulpa'

Fits Bayesian models for species observed with imperfect detection: single-season and dynamic site occupancy (MacKenzie et al. (2002) <doi:10.1890/0012-9658(2002)083[2248:ESORWD]2.0.CO;2>), N-mixture abundance from replicated counts (Royle (2004) <doi:10.1111/j.0006-341X.2004.00142.x>), distance sampling, removal and double-observer counts, false-positive and time-to-detection occupancy, integrated models combining several data sources, multi-species and joint species distribution models, and a hurdle model for vegetation cover. Linear predictors take fixed, random, spatial and temporal effects. Each model supplies its observation likelihood to the 'tulpa' engine, which fits it by Laplace approximation, by nested Laplace integration over the hyperparameters, or by Hamiltonian Monte Carlo with the No-U-Turn Sampler (NUTS) using automatic differentiation. Simulation, prediction and diagnostic functions (posterior predictive checks, leave-one-out cross-validation, simulation-based calibration) accompany each model.

Authors:Gilles Colling [aut, cre, cph]

tulpaObs_0.6.1.tar.gz
tulpaObs_0.6.1.zip(r-4.7-x86_64)tulpaObs_0.6.1.zip(r-4.7-arm64)tulpaObs_0.6.1.zip(r-4.6-x86_64)tulpaObs_0.6.1.zip(r-4.6-arm64)tulpaObs_0.6.1.zip(r-4.5-x86_64)
tulpaObs_0.6.1.tgz(r-4.6-x86_64)tulpaObs_0.6.1.tgz(r-4.6-arm64)tulpaObs_0.6.1.tgz(r-4.5-x86_64)tulpaObs_0.6.1.tgz(r-4.5-arm64)
tulpaObs_0.6.1.tar.gz(r-4.7-arm64)tulpaObs_0.6.1.tar.gz(r-4.7-x86_64)tulpaObs_0.6.1.tar.gz(r-4.6-arm64)tulpaObs_0.6.1.tar.gz(r-4.6-x86_64)
tulpaObs_0.6.1.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
tulpaObs/json (API)

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

Bug tracker:https://github.com/gcol33/tulpaobs/issues

Pkgdown/docs site:https://gillescolling.com

Uses libs:
  • c++– GNU Standard C++ Library v3
  • openmp– GCC OpenMP (GOMP) support library
Datasets:

On CRAN:

Conda:

bayesianecologyoccupancyspatialcppopenmp

6.01 score 57 scripts 96 exports 27 dependencies

Last updated from:c47095846b. Checks:15 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK536
linux-devel-x86_64OK540
source / vignettesOK654
linux-release-arm64OK541
linux-release-x86_64OK620
macos-release-arm64OK475
macos-release-x86_64OK1002
macos-oldrel-arm64OK452
macos-oldrel-x86_64OK1101
windows-devel-arm64OK775
windows-devel-x86_64OK822
windows-release-arm64OK785
windows-release-x86_64OK657
windows-oldrel-x86_64OK519
wasm-releaseOK365

Exports:abuncheck_modelconvergedconvergencecountcovercover_priorscpodicdistancedistsamp_opendouble_observerdyn_abundyn_int_occudyn_occufem_matricesfp_occugdistremovalglanceint_occujsdmlooms_abunms_countms_distancems_dyn_occums_int_occums_occums_occu_coverobs_familyoccuoccu_aggregation_scanoccu_categoricaloccu_coveroccu_cover_inputsoccu_multioccu_multiscale_coveroccu_priorsoccu_ttdpit_residualspointwise_loglikppcranefremovalroyle_nicholssbcsimulate_abunsimulate_countsimulate_coversimulate_cover_jointsimulate_distancesimulate_distsamp_opensimulate_double_observersimulate_dyn_abunsimulate_dyn_int_occusimulate_dyn_occusimulate_fp_occusimulate_gdistremovalsimulate_int_occusimulate_jsdmsimulate_ms_abunsimulate_ms_countsimulate_ms_distancesimulate_ms_dyn_occusimulate_ms_int_occusimulate_ms_occusimulate_ms_occu_coversimulate_ms_occu_cover_spatialsimulate_occusimulate_occu_categoricalsimulate_occu_coversimulate_occu_multisimulate_occu_multiscale_coversimulate_occu_ttdsimulate_removalsimulate_royle_nicholssimulate_t_occut_occutest_dispersiontest_outlierstest_uniformitytest_zero_inflationtidytobstobs_associationstobs_check_idtobs_datatobs_formattobs_format_mstobs_gettobs_marginal_effecttobs_predict_spatialtobs_richnesstobs_stackwaicwithin_between

Dependencies:abindbackportscheckmateclidistributionalgenericsgluelatticelifecycleloomagrittrMatrixmatrixStatsnumDerivpillarpkgconfigposteriorRcppRcppEigenRcppParallelrlangtensorAtibbletulpatulpaMeshutf8vctrs

Integrated occupancy: combining data sources
Installation | Two surveys, one species | The model | Simulating two sources | Fitting the integrated model | Why integration helps | Source-specific detection | Practical guidance | Where to go next

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

Areal spatial occupancy with ICAR, BYM2, and CAR
Installation | Adjacent regions share what the covariates miss | The three fields | Building the adjacency | Simulating data with a known field | Fitting an areal field | Recovering and mapping the field | The floating intercept | Checking the fit | Interpreting results: credible intervals and an uncertainty map | Predicting unsurveyed cells | Does the field earn its place? | Practical guidance | Where to go next

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

Community models in tulpaObs
Installation | Why fit many species at once | The model | Community occupancy | Species richness | Community N-mixture | Per-species deviations | Per-species overdispersion | Reading community against species-level effects | Practical guidance | The community engine | Where to go next

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

Cover hurdle (independent arms)
Installation | Introduction | The model | Simulating data | Fitting | Checking the fit | Interpreting results | Prediction | Model comparison | Practical guidance | Scope

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

Cover hurdle on resurvey panels (MOTIVATE reduction)
Installation | Introduction | The model | A MOTIVATE-style simulator | The two signals in year | Generate two panels | Within-between decomposition | Fitting the model | Exact row reduction | Parameter recovery | Within-plot trajectories | The three-arm model: occu_cover() | Checking the fit | Interpreting results | Prediction | Model comparison | Practical guidance | What the reduction leaves out | References

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

Cover hurdle: tulpaObs vs INLA on simulated cover data
Installation | Function mapping | Simulate | Fit with tulpaObs | Fit with INLA (Michael's separate-hurdle workflow) | Parameter recovery | Predictive equivalence | The joint copy= model side by side | Key differences | When NOT to switch | When the two diverge | References

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

Diagnostics: checking, comparing, and residuals
Installation | A fit to check | The one-call panel | WAIC and model comparison | Posterior-predictive checks | PIT residuals and uniformity | Simulation-based calibration | Dispersion, zero-inflation, and outliers | Residuals | Spatial residual diagnostics | Prior specification and its effect on the fit | A diagnostic workflow | Where to go next

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

Dynamic (multi-season) occupancy
Installation | When occupancy changes over time | The model | Simulating a trajectory | Fitting | Recovering the rates | Checking the fit | Turnover and equilibrium occupancy | Covariates on colonisation and extinction | Prediction | Comparing models | Full posterior with NUTS | Practical guidance | Where to go next

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

Getting started with tulpaObs
Installation | What tulpaObs fits | A first occupancy model | Occupancy, detection, and the latent state | Laplace and NUTS | Prediction | Random effects | Comparing models | Taste tests | Single-season occupancy | N-mixture abundance | Community models | Cover hurdle | Spatial occupancy | Dynamic occupancy | Integrated occupancy | S3 methods | Practical guidance | Where to go next

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

N-mixture abundance with tulpaObs
Installation | From presence to counts | The model | Simulating and fitting a Poisson model | The count ceiling K.max | Overdispersion and the negative binomial | Predicting abundance | Random effects on abundance | Counts on a map | Comparing models and practical guidance | Where to go next

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

Occupancy with a continuous SPDE spatial field
Installation | Introduction | The model | Simulating data | Fitting the model | Checking the fit | Interpreting results | Prediction | Model comparison | Practical guidance | References

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

Occupancy: tulpaObs vs INLA aggregated-binomial
Installation | Function mapping | Simulate detection histories with known $\psi$ and $p$ | tulpaObs: true occupancy fit via tobs(family = occu()) | INLA workaround: row-stack the detection histories, fit a single binomial | What the workaround estimates | Predictive divergence at the site level | What about the "detectability proxies" trick? | A second example: an IID site random effect both ways | Key differences | When NOT to switch | References

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

Random effects with lme4 bar syntax
Installation | When a grouping factor needs a random effect | Bar syntax | A random intercept under Laplace | The EM, the small-cluster bias, and the AGHQ debias | Correlated random slopes | Crossed and nested grouping | A random effect on detection | Laplace versus NUTS for random effects | Practical guidance | Where to go next

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

Shaping data for tobs()
Installation | Two pieces: the response and the site table | Site-level versus visit-level covariates | Building y from a long detection table | Building a tobs_data object by hand | Inspecting a tobs_data object | Missing visits | Validation | Response shapes per family | See also

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

Single-season occupancy
Installation | The detection problem | The model | The assumptions behind the model | Simulating data | Fitting | Checking the fit | Interpreting the estimates | Prediction | Comparing models | Identifiability and practical guidance | Sites, visits, and what you can estimate | Where to go next

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

Readme and manuals

Help Manual

Help pageTopics
Access spOccupancy-compatible fields from tobs fits$.tobs_fit
N-mixture abundance familyabun
Comprehensive model checkingcheck_model.tobs_fit
Per-species coefficients from a batched occu_cover fit.coef.tobs_batch
Coefficients for a tobs_fitcoef.tobs_fit
Convergence record for a fitted modelconverged converged.tobs_fit convergence convergence.tobs_fit
Count / relative-abundance GLMM family (no detection process)count
Cover hurdle family (vegetation cover, MOTIVATE pattern)cover
Weakly-informative priors for cover-hurdle Laplace fitscover_priors
Binned distance-sampling familydistance
Laplace fit of the binned distance-sampling abundance modeldistance_laplace
Open-population distance-sampling familydistsamp_open
Double-observer abundance familydouble_observer
Open-population (Dail-Madsen) N-mixture familydyn_abun
Maximum-likelihood fit of the Dail-Madsen open N-mixturedyn_abun_laplace
Multi-season integrated occupancy familydyn_int_occu
Dynamic (multi-season) occupancy familydyn_occu
Fitted values (occupancy and detection probabilities)fitted.tobs_fit
Repeated point-count abundance survey (synthetic)foray_counts
Multistate false-positive occupancy familyfp_occu
Maximum-likelihood fit of the multistate false-positive occupancy modelfp_occu_laplace
Joint distance + removal sampling familygdistremoval
One-row model summary for a tobs_fitglance.tobs_fit
Integrated occupancy familyint_occu
Joint species distribution family (no detection process)jsdm
Log-likelihood of a tobs fitlogLik.tobs_fit
Grassland vegetation-cover panel (synthetic)meadow_cover
Multispecies N-mixture familyms_abun
Multispecies (community) relative-abundance GLMM familyms_count
Community (multispecies) binned distance-sampling familyms_distance
Community (multispecies) dynamic occupancy familyms_dyn_occu
Community (multispecies) integrated occupancy familyms_int_occu
Multispecies (community) single-season occupancy familyms_occu
Community (multispecies) joint occupancy-detection + cover familyms_occu_cover
Laplace fit of the Royle (2004) N-mixture modelnmix_laplace
BYM2 Royle (2004) N-mixture model via nested Laplacenmix_laplace_bym2
Proper CAR Royle (2004) N-mixture model via nested Laplacenmix_laplace_car_proper
Spatial Royle (2004) N-mixture model via nested Laplacenmix_laplace_icar
Community / multispecies N-mixture by Laplacenmix_laplace_re
Per-site N-mixture marginal as a composable random-effect callbacknmix_site_marginal
Number of observationsnobs.tobs_fit
Single-season occupancy familyoccu
Suggest spatial and temporal aggregation for an identifiable occupancy modeloccu_aggregation_scan
Presence + nominal class hurdle familyoccu_categorical
Joint occupancy-detection + cover hurdle familyoccu_cover
Build occu_cover() model inputs from a long, plot-level frameoccu_cover_inputs
Multi-species co-occurrence occupancy familyoccu_multi
Three-level (multiscale) occupancy + cover hurdle familyoccu_multiscale_cover
Weakly-informative priors for occupancy Laplace fitsoccu_priors
Time-to-detection occupancy familyoccu_ttd
Peatland occupancy survey (synthetic)peatland_occu
PIT residuals for a tobs fitpit_residuals.tobs_fit
Plot an occupancy aggregation scanplot.tobs_aggregation_scan
Plot detection history patternsplot.tobs_data
Posterior predictive checkppc ppc.tobs_fit
Predict cover from a cover_fitpredict.cover_fit
Predict from an occu_categorical fitpredict.occu_categorical_fit
Predict from occupancy modelpredict.tobs_fit
Print a batched multi-response occu_cover fit.print.tobs_batch
Print method for tobs_familyprint.tobs_family
Print method for tobs_fitprint.tobs_fit
Random-effect estimates (BLUPs) for a tobs_fitranef.tobs_fit
Removal-sampling familyremoval
Laplace fit of the removal-sampling abundance modelremoval_laplace
Residuals from occupancy modelresiduals.tobs_fit
Royle-Nichols occupancy familyroyle_nichols
Simulation-based calibration for a fitted tobs modelsbc.tobs_fit
Simulate Royle (2004) N-mixture abundance datasimulate_abun
Simulate count / relative-abundance GLMM datasimulate_count
Simulate cover-hurdle data (lognormal positive part)simulate_cover
Simulate cover-hurdle data with a shared BYM2 spatial fieldsimulate_cover_joint
Simulate binned distance-sampling abundance datasimulate_distance
Simulate an open-population distance-sampling data setsimulate_distsamp_open
Simulate a double-observer abundance data setsimulate_double_observer
Simulate Dail-Madsen open N-mixture datasimulate_dyn_abun
Simulate a multi-season integrated occupancy data setsimulate_dyn_int_occu
Simulate temporal (multi-season) occupancy datasimulate_dyn_occu
Simulate multistate false-positive occupancy datasimulate_fp_occu
Simulate a joint distance + removal data setsimulate_gdistremoval
Simulate integrated (multi-source) occupancy datasimulate_int_occu
Simulate joint species distribution (presence/absence) datasimulate_jsdm
Simulate community (multispecies) N-mixture abundance datasimulate_ms_abun
Simulate community relative-abundance (count / continuous) datasimulate_ms_count
Simulate community (multispecies) binned distance-sampling datasimulate_ms_distance
Simulate temporal multi-species occupancy datasimulate_ms_dyn_occu
Simulate integrated multi-species occupancy datasimulate_ms_int_occu
Simulate multi-species occupancy datasimulate_ms_occu
Simulate community (multispecies) joint occupancy-cover datasimulate_ms_occu_cover
Simulate a reduced-rank spatial-factor community occu_cover data set (K = 1)simulate_ms_occu_cover_spatial
Simulate single-species occupancy datasimulate_occu
Simulate from an occu_categorical modelsimulate_occu_categorical
Simulate joint occupancy-detection + cover datasimulate_occu_cover
Simulate a multi-species co-occurrence occupancy data setsimulate_occu_multi
Simulate a three-level occupancy + cover hurdle data setsimulate_occu_multiscale_cover
Simulate a time-to-detection occupancy data setsimulate_occu_ttd
Simulate removal-sampling abundance datasimulate_removal
Simulate Royle-Nichols occupancy datasimulate_royle_nichols
Simulate multi-season occupancy with an AR1 year effect (tPGOcc)simulate_t_occu
Simulate replicate datasets from the posteriorsimulate.tobs_fit
Summarise occupancy datasummary.tobs_data
Summary for tobs_fit, with skewness column when simplified Laplace is usedsummary.tobs_fit
Multi-season occupancy with a temporal (AR1) year effect (tPGOcc)t_occu
Coefficient table for a tobs_fittidy.tobs_fit
Fit a hierarchical latent-state observation modeltobs
Residual species-association matrices from a spatial-factor community fittobs_associations
Check model identifiabilitytobs_check_id
Model criteria for occupancy / cover modelscpo.tobs_fit dic.tobs_fit loo.tobs_fit pointwise_loglik.tobs_fit tobs_criteria waic.tobs_fit
Convert long-format data to a site x visit observation objecttobs_data
Fixed-effect covariance and credible intervals for tobs_fitconfint.tobs_fit tobs_fit_intervals vcov.tobs_fit
Format occupancy data from matrices/liststobs_format
Format multi-species occupancy datatobs_format_ms
Extract one species' fit from a batched occu_cover fit.tobs_get
Goodness-of-fit tests for a tobs fittest_dispersion.tobs_fit test_outliers.tobs_fit test_zero_inflation.tobs_fit tobs_gof_tests
Compute marginal effect of a covariatetobs_marginal_effect
S3 methods for multi-arm fitscoef.tobs_multiarm_fit confint.tobs_multiarm_fit fitted.tobs_multiarm_fit glance.tobs_multiarm_fit logLik.tobs_multiarm_fit nobs.tobs_multiarm_fit plot.tobs_multiarm_fit residuals.tobs_multiarm_fit summary.tobs_multiarm_fit tidy.tobs_multiarm_fit tobs_multiarm_methods vcov.tobs_multiarm_fit
Predict the state process at new spatial locationstobs_predict_spatial
Estimate species richness from community modeltobs_richness
Stack fitted models into a LOO-weighted ensemblefitted.tobs_stack predict.tobs_stack print.tobs_stack tobs_stack
Structured terms inside a tobs() formulabym2 car_proper gp icar latent multiscale_gp re spatial spde svc temporal tobs_terms
Update and refit a tobs modelupdate.tobs_fit
Within / between (Mundlak) decomposition for longitudinal datawithin_between