Description Usage Arguments Details Value Warning Note Author(s) References See Also Examples

Fit the model of Dail and Madsen (2011) and Hostetler and Chandler (2015) with a distance sampling observation model (Sollmann et al. 2015).

1 2 3 4 5 6 7 | ```
distsampOpen(lambdaformula, gammaformula, omegaformula, pformula,
data, keyfun=c("halfnorm", "exp", "hazard", "uniform"),
output=c("abund", "density"), unitsOut=c("ha", "kmsq"),
mixture=c("P", "NB", "ZIP"), K,
dynamics=c("constant", "autoreg", "notrend", "trend", "ricker", "gompertz"),
fix=c("none", "gamma", "omega"), immigration=FALSE, iotaformula = ~1,
starts, method="BFGS", se=TRUE, ...)
``` |

`lambdaformula` |
Right-hand sided formula for initial abundance |

`gammaformula` |
Right-hand sided formula for recruitment rate (when dynamics is "constant", "autoreg", or "notrend") or population growth rate (when dynamics is "trend", "ricker", or "gompertz") |

`omegaformula` |
Right-hand sided formula for apparent survival probability (when dynamics is "constant", "autoreg", or "notrend") or equilibrium abundance (when dynamics is "ricker" or "gompertz") |

`pformula` |
A right-hand side formula describing the detection function covariates |

`data` |
An object of class |

`keyfun` |
One of the following detection functions: "halfnorm", "hazard", "exp", or "uniform" |

`output` |
Model either "density" or "abund" |

`unitsOut` |
Units of density. Either "ha" or "kmsq" for hectares and square kilometers, respectively |

`mixture` |
String specifying mixture: "P", "NB", or "ZIP" for the Poisson, negative binomial, or zero-inflated Poisson distributions respectively |

`K` |
Integer defining upper bound of discrete integration. This should be higher than the maximum observed count and high enough that it does not affect the parameter estimates. However, the higher the value the slower the computation |

`dynamics` |
Character string describing the type of population dynamics. "constant" indicates that there is no relationship between omega and gamma. "autoreg" is an auto-regressive model in which recruitment is modeled as gamma*N[i,t-1]. "notrend" model gamma as lambda*(1-omega) such that there is no temporal trend. "trend" is a model for exponential growth, N[i,t] = N[i,t-1]*gamma, where gamma in this case is finite rate of increase (normally referred to as lambda). "ricker" and "gompertz" are models for density-dependent population growth. "ricker" is the Ricker-logistic model, N[i,t] = N[i,t-1]*exp(gamma*(1-N[i,t-1]/omega)), where gamma is the maximum instantaneous population growth rate (normally referred to as r) and omega is the equilibrium abundance (normally referred to as K). "gompertz" is a modified version of the Gompertz-logistic model, N[i,t] = N[i,t-1]*exp(gamma*(1-log(N[i,t-1]+1)/log(omega+1))), where the interpretations of gamma and omega are similar to in the Ricker model |

`fix` |
If "omega", omega is fixed at 1. If "gamma", gamma is fixed at 0 |

`immigration` |
Logical specifying whether or not to include an immigration term (iota) in population dynamics |

`iotaformula` |
Right-hand sided formula for average number of immigrants to a site per time step |

`starts` |
Vector of starting values |

`method` |
Optimization method used by |

`se` |
Logical specifying whether or not to compute standard errors |

`...` |
Additional arguments to optim, such as lower and upper bounds |

These models generalize distance sampling models (Buckland et al. 2001) by relaxing the closure assumption (Dail and Madsen 2011, Hostetler and Chandler 2015, Sollmann et al. 2015).

The models include two or three additional parameters: gamma, either the recruitment rate (births and immigrations), the finite rate of increase, or the maximum instantaneous rate of increase; omega, either the apparent survival rate (deaths and emigrations) or the equilibrium abundance (carrying capacity); and iota, the number of immigrants per site and year. Estimates of population size at each time period can be derived from these parameters, and thus so can trend estimates. Or, trend can be estimated directly using dynamics="trend".

When immigration is set to FALSE (the default), iota is not modeled. When immigration is set to TRUE and dynamics is set to "autoreg", the model will separately estimate birth rate (gamma) and number of immigrants (iota). When immigration is set to TRUE and dynamics is set to "trend", "ricker", or "gompertz", the model will separately estimate local contributions to population growth (gamma and omega) and number of immigrants (iota).

The latent abundance distribution, *f(N |
theta)* can be set as a Poisson, negative binomial, or zero-inflated
Poisson random
variable, depending on the setting of the `mixture`

argument,
`mixture = "P"`

, `mixture = "NB"`

, `mixture = "ZIP"`

respectively. For the first two distributions, the mean of *N_i* is
*lambda_i*. If *N_i ~ NB*, then an
additional parameter, *alpha*, describes dispersion (lower
*alpha* implies higher variance). For the ZIP distribution,
the mean is *lambda_i*(1-psi)*, where psi is the
zero-inflation parameter.

For "constant", "autoreg", or "notrend" dynamics, the latent abundance state
following the initial sampling period arises
from a
Markovian process in which survivors are modeled as *S(i,t) ~ Binomial(N(i,t-1),
omega(i,t))*, and recruits
follow *G(i,t) ~
Poisson(gamma(i,t))*.
Alternative population dynamics can be specified
using the `dynamics`

and `immigration`

arguments.

*lambda_i*, *gamma_it*, and
*iota_it* are modeled
using the the log link.
*p_ijt* is modeled using
the logit link.
*omega_it* is either modeled using the logit link (for
"constant", "autoreg", or "notrend" dynamics) or the log link (for "ricker"
or "gompertz" dynamics). For "trend" dynamics, *omega_it*
is not modeled.

For the distance sampling detection process, half-normal (`"halfnorm"`

),
exponential (`"exp"`

), hazard (`"hazard"`

), and uniform
(`"uniform"`

) key functions are available.

An object of class unmarkedFitDSO

This function can be extremely slow, especially if there are covariates of gamma or omega. Consider testing the timing on a small subset of the data, perhaps with se=FALSE. Finding the lowest value of K that does not affect estimates will also help with speed.

When gamma or omega are modeled using year-specific covariates, the covariate data for the final year will be ignored; however, they must be supplied.

If the time gap between primary periods is not constant, an M by T
matrix of integers should be supplied to `unmarkedFrameDSO`

using the `primaryPeriod`

argument.

Secondary sampling periods are optional, but can greatly improve the precision of the estimates.

Optimization may fail if the initial value of the intercept for the detection parameter (sigma) is too small or large relative to transect width. By default, this parameter is initialized at log(average band width). You may have to adjust this starting value.

Richard Chandler, Jeff Hostetler, Andy Royle, Ken Kellner

Buckland, S.T., Anderson, D.R., Burnham, K.P., Laake, J.L., Borchers, D.L.
and Thomas, L. (2001) *Introduction to Distance Sampling: Estimating
Abundance of Biological Populations*. Oxford University Press, Oxford, UK.

Dail, D. and L. Madsen (2011) Models for Estimating Abundance from
Repeated Counts of an Open Metapopulation. *Biometrics*. 67: 577-587.

Hostetler, J. A. and R. B. Chandler (2015) Improved State-space Models for
Inference about Spatial and Temporal Variation in Abundance from Count Data.
*Ecology* 96: 1713-1723.

Sollmann, R., Gardner, B., Chandler, R.B., Royle, J.A. and Sillett, T.S.
(2015) An open-population hierarchical distance sampling model.
*Ecology* 96: 325-331.

`distsamp, gdistsamp, unmarkedFrameDSO`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | ```
## Not run:
#Generate some data
set.seed(123)
lambda=4; gamma=0.5; omega=0.8; sigma=25;
M=100; T=10; J=4
y <- array(NA, c(M, J, T))
N <- matrix(NA, M, T)
S <- G <- matrix(NA, M, T-1)
db <- c(0, 25, 50, 75, 100)
#Half-normal, line transect
g <- function(x, sig) exp(-x^2/(2*sig^2))
cp <- u <- a <- numeric(J)
L <- 1
a[1] <- L*db[2]
cp[1] <- integrate(g, db[1], db[2], sig=sigma)$value
for(j in 2:J) {
a[j] <- db[j+1] - sum(a[1:j])
cp[j] <- integrate(g, db[j], db[j+1], sig=sigma)$value
}
u <- a / sum(a)
cp <- cp / a * u
cp[j+1] <- 1-sum(cp)
for(i in 1:M) {
N[i,1] <- rpois(1, lambda)
y[i,1:J,1] <- rmultinom(1, N[i,1], cp)[1:J]
for(t in 1:(T-1)) {
S[i,t] <- rbinom(1, N[i,t], omega)
G[i,t] <- rpois(1, gamma)
N[i,t+1] <- S[i,t] + G[i,t]
y[i,1:J,t+1] <- rmultinom(1, N[i,t+1], cp)[1:J]
}
}
y <- matrix(y, M)
#Make a covariate
sc <- data.frame(x1 = rnorm(M))
umf <- unmarkedFrameDSO(y = y, siteCovs=sc, numPrimary=T, dist.breaks=db,
survey="line", unitsIn="m", tlength=rep(1, M))
(fit <- distsampOpen(~x1, ~1, ~1, ~1, data = umf, K=50, keyfun="halfnorm"))
#Compare to truth
cf <- coef(fit)
data.frame(model=c(exp(cf[1]), cf[2], exp(cf[3]), plogis(cf[4]), exp(cf[5])),
truth=c(lambda, 0, gamma, omega, sigma))
#Predict
head(predict(fit, type='lambda'))
#Check fit with parametric bootstrap
pb <- parboot(fit, nsims=15)
plot(pb)
# Empirical Bayes estimates of abundance for each site / year
re <- ranef(fit)
plot(re, layout=c(10,5), xlim=c(-1, 10))
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.