Learn R Programming

hierarchicalDS (version 3.0)

Functions to Perform Hierarchical Analysis of Distance Sampling Data

Description

Functions for performing hierarchical analysis of distance sampling data, with ability to use an areal spatial ICAR model on top of user supplied covariates to get at variation in abundance intensity. The detection model can be specified as a function of observer and individual covariates, where a parametric model is supposed for the population level distribution of covariate values. The model uses data augmentation and a reversible jump MCMC algorithm to sample animals that were never observed. Also included is the ability to include point independence (increasing correlation multiple observer's observations as a function of distance, with independence assumed for distance=0 or first distance bin), as well as the ability to model species misclassification rates using a multinomial logit formulation on data from double observers. There is also the the ability to include zero inflation, but this is only recommended for cases where sample sizes and spatial coverage of the survey are high.

Copy Link

Version

Install

install.packages('hierarchicalDS')

Monthly Downloads

38

Version

3.0

License

Unlimited

Maintainer

Paul B Conn

Last Published

July 2nd, 2019

Functions in hierarchicalDS (3.0)

get_confusion_mat

Fill a list with confusion matrices for each record
convert.HDS.to.mcmc

function to convert HierarchicalDS MCMC list vector (used in estimation) into an mcmc object (cf. coda package)
linear_adj

Produce an adjacency matrix for a vector
generate_inits

generate initial values for MCMC chain if not already specified by user
log_lambda_gradient

compute the first derivative of log_lambda likelihood component for Langevin-Hastings
get_mod_matrix

function to produce a design matrix given a dataset and user-specified formula object
calc_linex_a

estimate optimal 'a' parameter for linex loss function
get_confusion_array

Fill confusion array - one confusion matrix for each individual (DEPRECATED)
hierarchical_DS

Primary function for hierarchical, areal analysis of distance sampling data (without movement). This function pre-processes data and calls other functions to perform the analysis, and is the only function the user needs to call themselves.
generate_inits_misID

generate initial values for misID model if not already specified by user
rrw

SIMULATE AN ICAR PROCESS
switch_sample

function to sample from a specified probability density function
summary_N

calculate parameter estimates and confidence intervals for various loss functions
switch_pdf

function to calculate the joint pdf for a sample of values from one of a number of pdfs
plot_obs_pred

plot 'observed' versus predicted values for abundance of each species at each transect
sim_out

MCMC output from running example in Hierarchical DS
plot_N_map

function to plot a map of abundance. this was developed for spatio-temporal models in mind
stack_data_misID

function to stack data for midID updates (going from four dimensional array to a two dimensional array including observed groups
rect_adj

Produce an RW1 adjacency matrix for a rectangular grid for use with areal spatial models (queens move)
log_lambda_log_likelihood

compute the likelihood for nu parameters
mcmc_ds

Function for MCMC analysis
table.mcmc

function to export posterior summaries from an mcmc object to a table
probit.fct

Mrds probit detection and related functions
post_loss

function to calculate posterior predictive loss given the output object from hierarchicalDS
switch_sample_prior

function to sample from hyperpriors of a specified probability density function; note that initial values for sigma of lognormal random effects are fixed to a small value (0.05) to prevent numerical errors
rect_adj_RW2

Produce an RW2 Adjacency matrix for a rectangular grid for use with areal spatial models. This formulation uses cofficients inspired by a thin plate spline, as described in Rue & Held, section 3.4.2 Here I'm outputting an adjacency matrix of 'neighbor weights' which makes Q construction for regular latices easy to do when not trying to make inference about all cells (i.e., one can just eliminate rows and columns associated with cells one isn't interested in and set Q=-Adj+Diag(sum(Adj))
simdata

MCMC output from running example in Hierarchical DS
simulate_data

function to simulate double observer spatial distance sampling data subject to possible zero inflation and species misidentification
square_adj

Produce an adjacency matrix for a square grid
stack_data

function to stack data (going from three dimensional array to a two dimensional array including only "existing" animals