wiqid-package {wiqid}R Documentation

Estimation functions for wildlife population models


Quick and dirty functions to estimate occupancy, survival, abundance, species richness and diversity, etc. for wildlife populations.


There are a number of sophisticated programs for the analysis of wildlife data, producing estimates of occupancy, survival, abundance, or density. wiqid began as a collection of fast, bare-bones functions which can be run from R suitable for use when you are generating hundreds of simulated data sets.

We now use wiqid in basic wildlife study design and data analysis workshops, where we want to focus on the concepts behind occupancy, mark-recapture, survival, etc. and study design issues. Participants have used lm, glm and functions in the secr and BEST packages. So wiqid tries to match the look and feel of these functions.

All functions use standard data frames or matrices for data input. ML estimation functions return objects of class wiqid with parameter estimates on the transformed scale(usually logit functions), variance-covariance matrix, and back-transformed ‘real’ values; there are print and logLik methods. Bayesian functions (distinguished by an initial "B") return class Bwiqid objects, a data frame with a column of MCMC observations for each parameter, plus attributes for MCMC diagnostics; there are print and plot methods.

Simulations and bootstraps often generate weird data sets, eg. capture histories with no captures. These functions do not throw errors or give warnings if the data are weird, but return NAs if estimates cannot be calculated. Errors may still occur if the data are impossible, eg. 6 detections in 5 occasions.

The functions are listed by topic below.


Single-season occupancy

occSS general-purpose function; allows site- and survey-specific covariates
occSS0 a basic psi(.) p(.) model, faster if this is all you need
BoccSS0 a Bayesian implementation of the psi(.) p(.) model
occSSrn Royle-Nichols method
occSStime faster if you have only time effects, also does a plot
occSScovSite faster if you only have site-specific covariates
occ2sps single-season two-species models

Multi-season occupancy

occMS general-purpose function; parameters depend on covariates; slow
occMScovSite smaller range of covariate options
occMS0 a simple multi-season model with four parameters; faster
occMStime parameters vary by season; faster

DENSITY from spatial capture-recapture data

We use the secr package for ML estimation of density. For Bayesian estimation, wiqid offers:

Bsecr0 a Bayesian implementation of the intercept-only model

ABUNDANCE from closed-population capture-recapture data

Although data for genuinely closed populations are rare, this is an important conceptual stepping-stone from CJS models to robust models.

closedCapM0 simple model with constant capture probability
closedCapMt capture probability varies with time
closedCapMtcov allows for time-varying covariates
closedCapMh2 heterogenity with 2-mixture model
closedCapMhJK jackknife estimator for heterogeneity

SURVIVAL from capture-recapture data

Cormack-Jolly-Seber models

survCJS model with time-varying covariates
BsurvCJS a Bayesian implementation of the above
survCJSaj allows for different survival for adults and juveniles

Pollock's robust design

survRDah 2-stage estimation of survival and recruitment
survRD single stage maximum likelihood estimation

Note that the RD functions are preliminary attempts at coding these models and have not been fully tested or benchmarked.

SPECIES RICHNESS from species x sample matrices


richRarefy Mao's tau estimator for rarefaction
richCurve a shell for plug-in estimators, for example...
richSobs the number of species observed
richSingle the number of singletons observed
richDouble the number of doubletons observed
richUnique the number of uniques observed
richDuplicate the number of duplicates observed

Coverage estimators

richACE Chao's Abundance-based Coverage Estimator
richICE Chao's Incidence-based Coverage Estimator
richChao1 Chao1 estimator
richChao2 Chao2 estimator
richJack1 first-order jackknife estimator
richJack2 second-order jackknife estimator
richJackA1 abundance-based first-order jackknife estimator
richJackA2 abundance-based second-order jackknife estimator
richBoot bootstrap estimator
richMM Michaelis-Menten estimator
richRenLau Rennolls and Laumonier's estimator


Alpha diversity

All of these functions express diversity as the number of common species in the assemblage.

biodSimpson inverse of Simpson's index of dominance
biodShannon exponential form of Shannon's entropy
biodBerger inverse of Berger and Parker's index of dominance
biodBrillouin exponential form of Brillouin's index

Beta diversity / distance

All of these functions produce distance measures (not similarity) on a scale of 0 to 1. The function distShell provides a wrapper to produce a matrix of distance measures across a number of sites.

distBrayCurtis complement of Bray-Curtis index, aka 'quantitative Sørensen'
distChaoJaccCorr complement of Chao's Jaccard corrected index
distChaoJaccNaive complement of Chao's Jaccard naive index
distChaoSorCorr complement of Chao's Sørensen corrected index
distChaoSorNaive complement of Chao's Sørensen naive index
distChord distance between points on a normalised sphere
distJaccard complement of Jaccard's index of similarity
distMorisitaHorn complement of the Morisita-Horn index of similarity
distOchiai complement of the Ochiai coefficient of similarity
distPreston Preston's coefficient of faunal dissimilarity
distRogersTanimoto complement of the Rogers and Tanimoto's coefficient of similarity
distSimRatio complement of the similarity ratio
distSorensen complement of the Sorensen or Dice index of similarity
distWhittaker Whittaker's index of association


dippers Capture-recapture data for European dippers
distTestData artificial data set for distance measures
GrandSkinks multi-season occupancy data
KanhaTigers camera-trap data for tigers
KillarneyBirds abundance of birds in Irish woodlands
MeadowVoles mark-recapture data from a robust design study
railSims simulated detection/non-detection data for two species of rails
salamanders detection/non-detection data for salamanders
seedbank number of seeds germinating from samples of soil
Temburong counts of tree species in a 1ha plot in Brunei
TemburongBA basal area of tree species in a 1ha plot in Brunei
weta detection/non-detection data and covariates for weta


AICc AIC with small-sample correction
AICtable tabulate AIC for several models
allCombinations model formulae for combinations of covariates
plotPost graphic display of a posterior distribution
postPriorOverlap calculation and display of posterior/prior overlap
as.Bwiqid converts a range of classes of MCMC output to class Bwiqid so that wiqid's print and plot functions can be used.
diagnostic plots trace, density, and auto-correlation plots for MCMC output.


Mike Meredith

Maintainer: Mike Meredith <mmeredith@wcs.org>

[Package wiqid version 0.0.378]