dNmixtureAD: N-mixture distributions with AD support for use in 'nimble'...

dNmixtureADR Documentation

N-mixture distributions with AD support for use in nimble models

Description

dNmixtureAD_s and dNmixtureAD_v provide Poisson-Binomial mixture distributions of abundance ("N-mixture") for use in nimble models when automatic differentiation may be needed by an algorithm. Overdispersion alternatives are also provided.

Usage

dNmixtureAD_v(x, lambda, prob, Nmin = -1, Nmax = -1, len, log = 0)

dNmixtureAD_s(x, lambda, prob, Nmin = -1, Nmax = -1, len, log = 0)

rNmixtureAD_v(n, lambda, prob, Nmin, Nmax, len)

rNmixtureAD_s(n, lambda, prob, Nmin, Nmax, len)

dNmixtureAD_BNB_v(x, lambda, theta, prob, Nmin = -1, Nmax = -1, len, log = 0)

dNmixtureAD_BNB_s(x, lambda, theta, prob, Nmin = -1, Nmax = -1, len, log = 0)

dNmixtureAD_BNB_oneObs(x, lambda, theta, prob, Nmin = -1, Nmax = -1, log = 0)

rNmixtureAD_BNB_oneObs(n, lambda, theta, prob, Nmin = -1, Nmax = -1)

dNmixtureAD_BBP_v(x, lambda, prob, s, Nmin = -1, Nmax = -1, len, log = 0)

dNmixtureAD_BBP_s(x, lambda, prob, s, Nmin = -1, Nmax = -1, len, log = 0)

dNmixtureAD_BBP_oneObs(x, lambda, prob, s, Nmin = -1, Nmax = -1, log = 0)

dNmixtureAD_BBNB_v(
  x,
  lambda,
  theta,
  prob,
  s,
  Nmin = -1,
  Nmax = -1,
  len,
  log = 0
)

dNmixtureAD_BBNB_s(
  x,
  lambda,
  theta,
  prob,
  s,
  Nmin = -1,
  Nmax = -1,
  len,
  log = 0
)

dNmixtureAD_BBNB_oneObs(
  x,
  lambda,
  theta,
  prob,
  s,
  Nmin = -1,
  Nmax = -1,
  log = 0
)

rNmixtureAD_BNB_v(n, lambda, theta, prob, Nmin = -1, Nmax = -1, len)

rNmixtureAD_BNB_s(n, lambda, theta, prob, Nmin = -1, Nmax = -1, len)

rNmixtureAD_BNB_oneObs(n, lambda, theta, prob, Nmin = -1, Nmax = -1)

rNmixtureAD_BBP_v(n, lambda, prob, s, Nmin = -1, Nmax = -1, len)

rNmixtureAD_BBP_s(n, lambda, prob, s, Nmin = -1, Nmax = -1, len)

rNmixtureAD_BBP_oneObs(n, lambda, prob, s, Nmin = -1, Nmax = -1)

rNmixtureAD_BBNB_v(n, lambda, theta, prob, s, Nmin = -1, Nmax = -1, len)

rNmixtureAD_BBNB_s(n, lambda, theta, prob, s, Nmin = -1, Nmax = -1, len)

rNmixtureAD_BBNB_oneObs(n, lambda, theta, prob, s, Nmin = -1, Nmax = -1)

Arguments

x

vector of integer counts from a series of sampling occasions.

lambda

expected value of the Poisson distribution of true abundance

prob

detection probability (scalar for dNmixture_s, vector for dNmixture_v).

Nmin

minimum abundance to sum over for the mixture probability. Must be provided.

Nmax

maximum abundance to sum over for the mixture probability. Must be provided.

len

The length of the x vector

log

TRUE or 1 to return log probability. FALSE or 0 to return probability.

n

number of random draws, each returning a vector of length len. Currently only n = 1 is supported, but the argument exists for standardization of "r" functions.

theta

abundance overdispersion parameter required for negative binomial (*NB) N-mixture models. theta is parameterized such that variance of the negative binomial variable x is lambda^2 * theta + lambda

s

detection overdispersion parameter required for beta binomial (BB*) N-mixture models. s is parameterized such that variance of the beta binomial variable x is V(x) = N \* prob \* (1-prob) \* (N + s) / (s + 1)

Details

These nimbleFunctions provide distributions that can be used directly in R or in nimble hierarchical models (via nimbleCode and nimbleModel).

See dNmixture for more information about the N-mixture distributions.

The versions here can be used in models that will be used by algorithms that use nimble's system for automatic differentiation (AD). The primary difference is that Nmin and Nmax must be provided. There are no automatic defaults for these.

In the AD system some kinds of values are "baked in" (cannot be changed) to the AD calculations from the first call, unless and until the AD calculations are reset. For all variants of the dNmixtureAD distributions, the sizes of the inputs as well as Nmin and Nmax are baked in. These can be different for different iterations through a for loop (or nimble model declarations with different indices, for example), but the sizes and Nmin and Nmax values for each specific iteration will be "baked in" after the first call.

Value

The probability (or likelihood) or log probability of an observation vector x.

Author(s)

Ben Goldstein, Lauren Ponisio, and Perry de Valpine


nimbleEcology documentation built on June 27, 2024, 5:09 p.m.