Fit the models of Dail and Madsen (2011) and Hostetler and Chandler (in press), which are generalized forms of the Royle (2004) N-mixture model for open populations.

pcountOpen(lambdaformula, gammaformula, omegaformula, pformula,
  data, mixture = c("P", "NB", "ZIP"), K, dynamics=c("constant", "autoreg",
  "notrend", "trend", "ricker", "gompertz"), fix=c("none", "gamma", "omega"),
  starts, method = "BFGS", se = TRUE, immigration = FALSE,
  iotaformula = ~1, ...)



Right-hand sided formula for initial abundance


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")


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


Right-hand sided formula for detection probability


An object of class unmarkedFramePCO. See details


character specifying mixture: "P", "NB", or "ZIP" for the Poisson, negative binomial, and zero-inflated Poisson distributions.


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 compuatation.


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.


If "omega", omega is fixed at 1. If "gamma", gamma is fixed at 0.


vector of starting values


Optimization method used by optim.


logical specifying whether or not to compute standard errors.


logical specifying whether or not to include an immigration term (iota) in population dynamics.


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


additional arguments to be passed to optim.


These models generalize the Royle (2004) N-mixture model by relaxing the closure assumption. 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 | \mathbf{\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 \sim 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_{it} \sim Binomial(N_{it-1}, \omega_{it})\), and recruits follow \(G_{it} \sim Poisson(\gamma_{it})\). Alternative population dynamics can be specified using the dynamics and immigration arguments.

The detection process is modeled as binomial: \(y_{ijt} \sim Binomial(N_{it}, p_{ijt})\).

\(\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.


An object of class unmarkedFitPCO.


Royle, J. A. (2004) N-Mixture Models for Estimating Population Size from Spatially Replicated Counts. Biometrics 60, pp. 108--105.

Dail, D. and L. Madsen (2011) Models for Estimating Abundance from Repeated Counts of an Open Metapopulation. Biometrics. 67, pp 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.


Richard Chandler and Jeff Hostetler


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 unmarkedFramePCO using the primaryPeriod argument.

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


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.

See also


## Simulation ## No covariates, constant time intervals between primary periods, and ## no secondary sampling periods set.seed(3) M <- 50 T <- 5 lambda <- 4 gamma <- 1.5 omega <- 0.8 p <- 0.7 y <- N <- matrix(NA, M, T) S <- G <- matrix(NA, M, T-1) N[,1] <- rpois(M, lambda) for(t in 1:(T-1)) { S[,t] <- rbinom(M, N[,t], omega) G[,t] <- rpois(M, gamma) N[,t+1] <- S[,t] + G[,t] } y[] <- rbinom(M*T, N, p) # Prepare data umf <- unmarkedFramePCO(y = y, numPrimary=T) summary(umf)
#> unmarkedFrame Object #> #> 50 sites #> Maximum number of observations per site: 5 #> Mean number of observations per site: 5 #> Number of primary survey periods: 5 #> Number of secondary survey periods: 1 #> Sites with at least one detection: 50 #> #> Tabulation of y observations: #> 0 1 2 3 4 5 6 7 8 9 13 #> 12 17 56 63 37 28 16 14 5 1 1
# Fit model and backtransform (m1 <- pcountOpen(~1, ~1, ~1, ~1, umf, K=20)) # Typically, K should be higher
#> #> Call: #> pcountOpen(lambdaformula = ~1, gammaformula = ~1, omegaformula = ~1, #> pformula = ~1, data = umf, K = 20) #> #> Abundance: #> Estimate SE z P(>|z|) #> 1.34 0.151 8.84 9.37e-19 #> #> Recruitment: #> Estimate SE z P(>|z|) #> 0.389 0.183 2.12 0.0339 #> #> Apparent Survival: #> Estimate SE z P(>|z|) #> 1.71 0.51 3.36 0.000792 #> #> Detection: #> Estimate SE z P(>|z|) #> 0.613 0.359 1.71 0.0875 #> #> AIC: 936.5712
(lam <- coef(backTransform(m1, "lambda"))) # or
#> [1] 3.806152
lam <- exp(coef(m1, type="lambda")) gam <- exp(coef(m1, type="gamma")) om <- plogis(coef(m1, type="omega")) p <- plogis(coef(m1, type="det")) if (FALSE) { # Finite sample inference. Abundance at site i, year t re <- ranef(m1) devAskNewPage(TRUE) plot(re, layout=c(5,5), subset = site %in% 1:25 & year %in% 1:2, xlim=c(-1,15)) devAskNewPage(FALSE) (N.hat1 <- colSums(bup(re))) # Expected values of N[i,t] N.hat2 <- matrix(NA, M, T) N.hat2[,1] <- lam for(t in 2:T) { N.hat2[,t] <- om*N.hat2[,t-1] + gam } rbind(N=colSums(N), N.hat1=N.hat1, N.hat2=colSums(N.hat2)) }