Last chance! 50% off unlimited learning
Sale ends in
gmultmix(lambdaformula, phiformula, pformula, data, mixture = c("P", "NB"), K,
starts, method = "BFGS", control = list(), se = TRUE)
optim
optim
mixture
argument. mixture = "P"
or mixture = "NB"
select
the Poisson or negative binomial distribution respectively. The mean of
$M_i$ is $\lambda_i$. If $M_i \sim NB$, then an
additional parameter, $\alpha$, describes dispersion (lower
$\alpha$ implies higher variance).
The number of individuals available for detection at time t
is a modeled as binomial:
$N_{it} \sim Binomial(M_i, \mathbf{\phi_ij})$.
The detection process is modeled as multinomial:
$y_{ij} \sim
Multinomial(N_it, pi_{itj})$,
where $pi_itj$ is the multinomial cell probability for plot i at time t on
occasion j.
Cell probabilities are computed via a user-defined function related to the
sampling design. Alternatively, the default functions removalPiFun
or doublePiFun
can be used for equal-interval removal sampling or
double observer sampling. Note that the function for computing cell probabilites
is specified when setting up the data using unmarkedFrameGMM
.
Parameters $\lambda$, $\phi$ and $p$ can be
modeled as linear functions of covariates using the log, logit and logit links
respectively.unmarkedFrameGMM
for setting up the data and metadata.
multinomPois
for surveys where no secondary sampling periods were
used. Example functions to calculate multinomial cell probabilities are
described piFuns
# Simulate data using the multinomial-Poisson model with a
# repeated constant-interval removal design.
n <- 100 # number of sites
T <- 4 # number of primary periods
J <- 3 # number of secondary periods
lam <- 3
phi <- 0.5
p <- 0.3
#set.seed(26)
y <- array(NA, c(n, T, J))
M <- rpois(n, lam) # Local population size
N <- matrix(NA, n, T) # Individuals available for detection
for(i in 1:n) {
N[i,] <- rbinom(T, M[i], phi)
y[i,,1] <- rbinom(T, N[i,], p) # Observe some
Nleft1 <- N[i,] - y[i,,1] # Remove them
y[i,,2] <- rbinom(T, Nleft1, p) # ...
Nleft2 <- Nleft1 - y[i,,2]
y[i,,3] <- rbinom(T, Nleft2, p)
}
y.ijt <- cbind(y[,1,], y[,2,], y[,3,], y[,4,])
umf1 <- unmarkedFrameGMM(y=y.ijt, numPrimary=T, type="removal")
(m1 <- gmultmix(~1, ~1, ~1, data=umf1, K=30))
backTransform(m1, type="lambda") # Individuals per plot
backTransform(m1, type="phi") # Probability of being avilable
(p <- backTransform(m1, type="det")) # Probability of detection
p <- coef(p)
# Multinomial cell probabilities under removal design
c(p, (1-p) * p, (1-p)^2 * p)
# Or more generally:
head(getP(m1))
Run the code above in your browser using DataLab