Learn R Programming

unmarked (version 0.11-0)

ranef-methods: Methods for Function ranef in Package unmarked

Description

Estimate posterior distributions of the random variables (latent abundance or occurrence) using empirical Bayes methods. These methods return an object storing the posterior distributions of the latent variables at each site, and for each year (primary period) in the case of open population models. See unmarkedRanef-class for methods used to manipulate the returned object.

Arguments

Methods

signature(object = "unmarkedFitOccu")
Computes the conditional distribution of occurrence given the data and the estimates of the fixed effects, $Pr(z(i)=1 | y(i,j), psi(i), p(i,j))$
signature(object = "unmarkedFitOccuRN")
Computes the conditional abundance distribution given the data and the estimates of the fixed effects, $Pr(N(i)=k | y(i,j), psi(i), r(i,j)) for k = 0,1,...,K$
signature(object = "unmarkedFitPCount")
$Pr(N(i)=k | y(i,j), lambda(i), p(i,j)) for k = 0,1,...,K$
signature(object = "unmarkedFitMPois")
$Pr(N(i)=k | y(i,j), lambda(i), p(i,j)) for k = 0,1,...,K$
signature(object = "unmarkedFitDS")
$Pr(N(i)=k | y(i,1:J), lambda(i), sigma(i)) for k = 0,1,...,K$
signature(object = "unmarkedFitGMM")
$Pr(N(i)=k | y(i,1:J,t), lambda(i), phi(i,t), p(i,j,t)) for k = 0,1,...,K$
signature(object = "unmarkedFitGDS")
$Pr(N(i)=k | y(i,1:J,t), lambda(i), phi(i,t), sigma(i,t)) for k = 0,1,...,K$
signature(object = "unmarkedFitColExt")
$Pr(z(i,t)=1 | y(i,j,t), psi(i), gamma(i,t), epsilon(i,t), p(i,j,t)) for k = 0,1,...,K$
signature(object = "unmarkedFitPCO")
$Pr(N(i,t)=k | y(i,j,t), lambda(i), gamma(i,t), omega(i,t), iota(i,t), p(i,j,t)) for k = 0,1,...,K$

Warning

Empirical Bayes methods can underestimate the variance of the posterior distribution because they do not account for uncertainty in the hyperparameters (lambda or psi). Eventually, we hope to add methods to account for the uncertainty of the hyperparameters. Note also that the posterior mode appears to exhibit some bias as an estimator or abundance. Consider using the posterior mean instead, even though it will not be an integer in general. More simulation studies are needed to evaluate the performance of empirical Bayes methods for these models.

References

Laird, N.M. and T.A. Louis. 1987. Empirical Bayes confidence intervals based on bootstrap samples. Journal of the American Statistical Association 82:739--750.

Carlin, B.P and T.A Louis. 1996. Bayes and Empirical Bayes Methods for Data Analysis. Chapman and Hall/CRC.

Royle, J.A and R.M. Dorazio. 2008. Hierarchical Modeling and Inference in Ecology. Academic Press.

See Also

unmarkedRanef-class

Examples

Run this code
# Simulate data under N-mixture model
set.seed(4564)
R <- 20
J <- 5
N <- rpois(R, 10)
y <- matrix(NA, R, J)
y[] <- rbinom(R*J, N, 0.5)

# Fit model
umf <- unmarkedFramePCount(y=y)
fm <- pcount(~1 ~1, umf, K=50)

# Estimates of conditional abundance distribution at each site
(re <- ranef(fm))
# Best Unbiased Predictors
bup(re, stat="mean")           # Posterior mean
bup(re, stat="mode")           # Posterior mode
confint(re, level=0.9) # 90% CI

# Plots
plot(re, subset=site %in% c(1:10), layout=c(5, 2), xlim=c(-1,20))

# Compare estimates to truth
sum(N)
sum(bup(re))

# Extract all values in convenient formats
post.df <- as(re, "data.frame")
head(post.df)
post.arr <- as(re, "array")


Run the code above in your browser using DataLab