Hello Jeff and the spOccupancy group,
A colleague and I are using msNMix() function in the spAbundance package to run multi-species n-mixture models on an amphibian community dataset in a stacked data format for each survey year. The goal of these analyses is to evaluate impacts of different vegetation communities on the amphibian community, so we are interested in the community-level responses to various vegetation covariates. When running the waicAbund() function on a null model one of the species is returning Inf values in the elpd and WAIC columns (see table below). We are hoping for some advice on this issue and whether we should change our priors or attempt to use a different model to analyze these data.
Additional information:
The data is from herpetofauna capture data from 6 sites over a 4-year period, and we are modeling data from 11 amphibian species. We selected a negative binominal distribution after fitting simple models with single covariate in both the abundance and detection formula with a negative binomial and Poisson distribution. We compared the fit of these models using the ppcAbund() function, but we did not initially run WAIC test on these models. After realizing the issues with WAIC, we did attempt to calculate WAIC for these simplified models, and they similarly calculated Inf values.
The species with Inf values returned by WAIC does not appear to have converged for the species-level abundance or detection beta coefficients. I think one potential issue in this dataset may be that during the second trapping year, we captured many more individuals of the species with convergence issues than in the previous year or in the following two years, so capture numbers/ abundance is greatly inflated during that one year (0-10 captures at sites in the first year, 100-600 captures at sites in the second year, 0-50 captures at sites in the third year, and 0-10 captures at sites in the fourth year).
R code used for running null model:
n.batch = 5000
batch.length = 25
n.thin = 50
n.chains = 3
n.samples <- n.batch * batch.length
n.burn <- 0.6*(n.batch*batch.length)
n.sp <- dim(data_list$y)[1]
ms.inits <- list(alpha.comm = 0, # community-level detection coefficients
beta.comm = 0, # community-level abundance coefficients
beta = 0, # species-level detection coefficients
alpha = 0, # species-level abundance coefficients
tau.sq.beta = 1, # community-level abundance variance parameters
kappa = 1, # species-level negative binomial overdispersion parameters
tau.sq.alpha = 1, # community-level detection variance parameters
sigma.sq.mu = 0.5, # random effect variances for abundance
N = apply(data_list$y, c(1, 2), max, na.rm = TRUE)) #latent abundance variables for all species
ms.priors <- list(beta.comm.normal = list(mean = 0, var = 100), #normal prior on the community-level abundance mean effects
alpha.comm.normal = list(mean = 0, var = 2.72), #normal prior on the community-level detection mean effects
tau.sq.beta.ig = list(a = 0.1, b = 0.1), #inverse-Gamma prior on the community-level abundance variance parameters
tau.sq.alpha.ig = list(a = 0.1, b = 0.1), #inverse-Gamma prior on the community-level detection variance parameters
sigma.sq.mu.ig = list(a = 0.1, b = 0.1), #inverse-Gamma prior on the abundance random effect variances
kappa.unif = list(a = 0, b = 100)) # uniform prior on the species-specific overdispersion parameters
# Specify initial tuning values
ms.tuning <- list(beta = 0.3, alpha = 0.3, beta.star = 0.5, alpha.star = 0.5, kappa = 0.5)
# null model
null_mod <- msNMix(abund.formula = ~ 1,
det.formula = ~ 1 ,
data = data_list,
inits = ms.inits,
tuning = ms.tuning,
family = 'NB',
priors = ms.priors,
n.omp.threads = 7,
verbose = TRUE,
n.report = 400,
n.burn = n.burn,
n.thin = n.thin,
n.chains = n.chains,
n.batch = n.batch,
batch.length = batch.length)
waicAbund(null_mod, by.species = TRUE)
Any advice would be greatly appreciated.
Thank you,
Duston
--
You received this message because you are subscribed to the Google Groups "spOccupancy and spAbundance users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spocc-spabund-u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/spocc-spabund-users/a86be893-2fef-4446-b7d1-5f3e76b4f992n%40googlegroups.com.