Description Usage Arguments Details Value Author(s) References See Also Examples
Fits joint N-mixture models for site-associated species
1 2 |
sp1 |
observation matrix for species 1 |
sp2 |
observation matrix for species 2 |
start |
initial values for the optimization process |
method |
optimization method passed to |
K |
truncation number of the infinite summations in the log-likelihood. Defaults to |
mixture |
two-character vector for latent abundance distributions. |
Xp1 |
model matrix for detection probabilities of species 1 |
Xp2 |
model matrix for detection probabilities of species 2 |
Xl1 |
model matrix for abundance of species 1 |
Xl2 |
model matrix for linking parameter of species 2 |
Xpsi |
model matrix for abundance of species 2 |
includepsi |
logical. If FALSE, psi is not estimated and set to zero |
The function fits a bivariate extension to Royle's (2004) N-mixture model to data on the abundance of two species collected at R sites over T time occasions. The model for observation on site i at time t for species 1 can be specified as
Y_{1it}|N_{1i} ~ Bin(N_{1i},p_{1it})
N_{1i} ~ a count distribution with mean λ_{1i}.
The model for species 2 is
Y_{2it}|N_{1i},N_{2i} ~ Bin(N_{2i},p_{2it})
N_{2i}|N_{1i} ~ a count distribution with mean ψ+λ_{2i}N_{1i}.
Here, users may define a Poisson or negative binomial distribution for the latent abundances N_1i and N_2i.
An object of class jointNmix
and Nmix
, for which many methods are available (see methods(class = "jointNmix")
and methods(class = "Nmix")
)
Rafael A. Moral <rafael_moral@yahoo.com.br>, Clarice G. B. Demétrio and John Hinde
Moral, R.A., Hinde, J., Demétrio, C.G.B., Reigada, C. and Godoy, W.A.C. (submitted) Models for jointly estimating abundance of two unmarked site-associated species subject to imperfect detection.
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 | ## simulating data with poisson latent abundances
R <- 10 # sites
T <- 10 # time occasions
lambda1 <- 5
psi <- 3
p1 <- .3
p2 <- .6
lambda2 <- .5
set.seed(1234); N1 <- rpois(R, lambda1)
set.seed(1234); N2 <- rpois(R, psi + lambda2*N1)
y1 <- y2 <- matrix(0, ncol=T, nrow=R)
set.seed(1234); for(i in 1:R) y1[,i] <- rbinom(T, N1, p1)
set.seed(1234); for(i in 1:R) y2[,i] <- rbinom(T, N2, p2)
Xp <- cbind(rep(1, R*T))
Xl <- cbind(rep(1, R))
## Not run:
## fitting the Poisson-Poisson joint N-mixture model
fitpp <- jointNmix(y1, y2, Xp1=Xp, Xp2=Xp, Xl1=Xl, Xl2=Xl, mixture=c("P","P"), K=30)
## fitting the negbin-Poisson joint N-mixture model
fitnbp <- jointNmix(y1, y2, Xp1=Xp, Xp2=Xp, Xl1=Xl, Xl2=Xl, mixture=c("NB","P"), K=30)
## likelihood-ratio test between P-P and NB-P models
anova(fitpp, fitnbp)
## comparing using AIC
lapply(list(fitpp, fitnbp), AIC)
## conditional posterior probability functions for abundances
plot(fitpp, posterior = TRUE)
## estimated abundances vs. true abundances
data.frame(getranef.jointNmix(fitpp), N1, N2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.