Learn R Programming

⚠️There's a newer version (3.0) of this package.Take me there.

hierarchicalDS (version 2.9)

Functions For Performing 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. New in version 2.1 is 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

18

Version

2.9

License

Unlimited

Maintainer

Paul B Conn

Last Published

November 26th, 2014

Functions in hierarchicalDS (2.9)

switch_pdf

function to calculate the joint pdf for a sample of values from one of a number of pdfs
table.mcmc

function to export posterior summaries from an mcmc object to a table
square_adj

Produce an adjacency matrix for a square grid
log_lambda_log_likelihood

compute the likelihood for nu parameters
plot_obs_pred

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

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

function to sample from a specified probability density function
simulate_data

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

generate initial values for MCMC chain if not already specified by user
convert.HDS.to.mcmc

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

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

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

MCMC output from running example in Hierarchical DS
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))
get_mod_matrix

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

compute the first derivative of log_lambda likelihood component for Langevin-Hastings
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
probit.fct

Mrds probit detection and related functions
rect_adj

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

MCMC output from running example in Hierarchical DS
generate_inits_misID

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

estimate optimal 'a' parameter for linex loss function
summary_N

calculate parameter estimates and confidence intervals for various loss functions
get_confusion_mat

Fill a list with confusion matrices for each record
stack_data_misID

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

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

SIMULATE AN ICAR PROCESS
linear_adj

Produce an adjacency matrix for a vector
mcmc_ds

Function for MCMC analysis
hierarchical_DS

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