Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

posteriorSamples

Draw samples from the posterior predictive distribution


Description

Draw samples from the empirical Bayes posterior predictive distribution derived from unmarked models or ranef objects

Usage

## S4 method for signature 'unmarkedRanef'
posteriorSamples(object, nsims=100, ...)
## S4 method for signature 'unmarkedFit'
posteriorSamples(object, nsims=100, ...)

Arguments

object

An object inheriting class unmarkedRanef or unmarkedFit

nsims

Number of draws to make from the posterior predictive distribution

...

Other arguments

Value

unmarkedPostSamples object containing the draws from the posterior predictive distribution. The draws are in the @samples slot.

Author(s)

See Also

Examples

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

#Draw from the posterior predictive distribution
(ppd <- posteriorSamples(re, nsims=100))

unmarked

Models for Data from Unmarked Animals

v1.1.0
GPL (>= 3)
Authors
Richard Chandler [aut], Ken Kellner [aut], Ian Fiske [aut], David Miller [aut], Andy Royle [cre, aut], Jeff Hostetler [aut], Rebecca Hutchinson [aut], Adam Smith [aut], Marc Kery [ctb], Mike Meredith [ctb], Auriel Fournier [ctb], Ariel Muldoon [ctb], Chris Baker [ctb]
Initial release
2021-05-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.