Description Usage Arguments Details Value Examples
This function converts posterior samples from site-level regression coefficients into posterior samples from the derived site-level occurence probability using the logit link function. If psi was sampled directly using a beta-binomial sampler, if restructures these samples into an appropriate format.
1 |
msocc_mod |
output from |
This function returns one column for each replicate and arranges the columns by site, sample, and replicate.
an object of class matrix
of dimension num.mcmc
by
sum(K)
of posterior samples of psi.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | data(fung)
# prep data
fung.detect <- fung %>%
dplyr::select(1:4)
site.df <- fung %>%
dplyr::select(-sample, -pcr1, -pcr2) %>%
dplyr::distinct(site, .keep_all = TRUE) %>%
dplyr::arrange(site)
sample.df <- fung %>%
dplyr::select(-pcr1, -pcr2) %>%
dplyr::arrange(site, sample)
# fit intercept model at all three levels use beta-binomial sampler
fung_mod1 <- msocc_mod(wide_data = fung.detect, progress = T,
site = list(model = ~ 1, cov_tbl = site.df),
sample = list(model = ~ 1, cov_tbl = sample.df),
rep = list(model = ~ 1, cov_tbl = sample.df), # covariates aggregated at sample level
num.mcmc = 1000, beta_bin = T)
psi_mcmc(fung_mod1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.