Skip to content

v0.7.3

Latest
Compare
Choose a tag to compare
@doserjef doserjef released this 28 Mar 21:01
· 15 commits to main since this release

spOccupancy 0.7.3

  • Fixed a problem that could arise when calculating Rhat in all models when running multiple chains (but usually only happened in multispecies models) when there was a high amount of correlation between parameter estimates. This would lead to the model running completely, but then failing after all chains have been run. This most often occurred when fitting a multispecies model with a lot of rare species. Thanks to Marc Kery for bringing this to my attention.
  • Added in a check at the top of all model fitting functions to return an error when the number of posterior samples saved based on the MCMC criteria (n.batch, batch.length, n.samples, n.burn, n.thin, n.chains) are specified in a way that leads to a non-integer value. In such situations, models would previously run and return without an error, but sometimes the last posterior sample in any given chain could have widely inaccurate values, or values that prevented subsequent functions from working. Thanks to Wendy Leuenberger and Colin Swider for bringing this to my attention.
  • Added in functionality for fitting spatially-explicit models where the spatial random effects (or spatially varying coefficients) are not specified at the individual site, but rather are specified at a larger spatial resolution. This is accomplished using a new component of the data list supplied to model fitting functions called grid.index. This is useful for data sets where there is some sort of nested structuring among the data collection protocol, such that you may wish to specify the spatial random effects at a lower resolution than each individual location. Further, it can be particularly useful for SVC models where you only want to specify nonstationarity at a lower spatial resolution (e.g., across a set of grid cells). This is currently implemented for the following functions: spPGOcc, sfMsPGOcc, stMsPGOcc, stPGOcc, svcPGOcc, svcTMsPGOcc, svcTPGOcc. See the documentation for a given model function for how to specify this. I am hoping to eventually write up a small example that shows how to do this, but for now documentation is fairly limited to just the manual pages for each function. Feel free to contact me if you want to use this functionality and have any questions.
  • Added in the updateMCMC() function. This function is in active development, but it will ultimately allow for all spOccupancy and spAbundance model objects to be updated with additional MCMC samples, instead of having to completely rerun an MCMC analysis if adequate burn-in/convergence was not reached. It currently works for the function sfJSDM() in spOccupancy and msAbund() in spAbundance.
  • Added in the ability to specify independent priors for the species-level regression coefficients for two functions: svcTMsPGOcc and sfJSDM. This is done by setting the tags independent.betas and independent.alphas to TRUE. This will fix the values of the community-level mean and variance parameters to the initial values specified in inits. This is equivalent to setting an independent Gaussian prior for each of the species-specific regression coefficients, which may potentially be useful in certian situations where the assumption of normality in the distribution of the species-level effects is not well met. This functionality will eventually be incorporated for all multi-species models.
  • Fixed a bug in intMsPGOcc() that caused the model to crash upon initialization of the MCMC algorithm when data were supplied in a way such that for a given data set, the maximum number of times a specific site was sampled was less than the total number of "replicate periods" (i.e., the third dimension of the data list). This may happen when the "replicates" are structured as specific time periods (i.e., weeks, years) instead of a specific "replicate". This was previously fixed in all other model fitting functions.
  • Wrote a new "vignette" (really more of a blog post) on some recommendations to help improve interpretability of inferences in SVC models.
  • Fixed a few typos in the MCMC sampler vignettes for factor models and SVC models.
  • Fixed a bug that prevented cross-validation from working properly in multi-species models when setting k.fold.only = TRUE. Thanks to Zack Steel for pointing this out.