Skip to content

Releases: doserjef/spOccupancy

v0.7.3

28 Mar 21:01
Compare
Choose a tag to compare

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.

v0.7.0

27 Jul 18:12
Compare
Choose a tag to compare

spOccupancy v0.7.0 contains a variety of substantial updates, most notably functionality for fitting non-spatial and spatial multi-species multi-season occupancy models, as well as multi-species spatially-varying coefficient models. There are also a variety of smaller bug fixes/additional error handling that will help eliminate some common hard-to-interpret errors that users encountered. This version will be sent to CRAN on August 16, 2023.

  • New functionality for fitting multi-species, multi-season occupancy models. The function tMsPGOcc() fits non-spatial, multi-season, multi-species occupancy models, and the function stMsPGOcc() fits spatial, multi-season occupancy models. The spatially-explicit function also inherently accounts for species correlations with a spatial factor modeling approach (e.g., they are joint species distribution models with imperfect detection and species correlations). See Doser et al. 2023 for statistical details on the spatial factor modeling approach. A vignette will be posted that details fitting these models in depth in the coming months, but the syntax is essentially a combination of multi-species models (e.g. msPGOcc(), sfMsPGOcc()) and multi-season single-species models (i.e., tPGOcc() and stPGOcc()), so the recommendations provided in the vignettes for those models is applicable for these models as well.
  • New functionality for multi-species spatially-varying coefficient occupancy models for single-season (svcMsPGOcc()) and multi-season (svcTMsPGOcc()) models. These approaches use a spatial factor modeling approach for each of the SVCs to make the models relatively computationally efficient. The functions inherently account for species correlations. The vignette on spatially-varying coefficients provides an example for svcMsPGOcc(), with an example for svcTMsPGOcc() coming soon.
  • The function simTMsOcc() simulates multi-season, multi-species occupancy models.
  • Updated getSVCSamples() to now work with multi-species spatially-varying coefficient models.
  • Added in a new check in all spatially-explicit models to see if all the spatial coordinates in the data$coords object were unique, as this is a requirement for spOccupancy spatially-explicit models. In previous versions, this resulted in an error of c++ error: dpotrf failed, or something along those lines, which was a common source of confusion.
  • Updated all model fitting functions to avoid running for a long time, just to eventually crash. Now, if trying to run models and save an object that is too large for memory, R should crash at the beginning. This occurred in situations where the n.burn argument was greater than 0 and/or n.thin was greater than 1. Thanks to Alex Bacjz for bringing this to my attention.
  • Added in the by.sp argument to waicOcc() to allow users to calculate WAIC separately for individual species in all multi-species model types in spOccupancy.
  • Minor updates to multiple vignettes to reflect changes since their original versions.

v0.6.0

16 Jan 21:45
Compare
Choose a tag to compare

spOccupancy v0.6.0 incorporates new functionality to fit a non-spatial integrated multi-species occupancy model using the function intMsPGOcc(). This fits a single-season version of the "intgrated community occupancy model" from Doser et al. 2022. The function intMsPGOcc() should be considered experimental and is still under development. We have done adequate testing of the function and users can be confident the resulting estimates are correct. Rather, we consider this "experimental" because it lacks all the functionality currently supported for other spOccupancy model types. In particular, intMsPGOcc model objects do not currently work with ppcOcc() (posterior predictive checks), fitted() (generated fitted values), or k-fold cross-validation, and there may be specific data set situations that cause the function to break. Please contact us if you use the function and have any feedback or run into any problems. We are in active development of the associated spatial versions of the function (both without spatial factors and with spatial factors), as well as the above mentioned limitations. intMsPGOcc() does not currently support random effects in the detection models, which we are actively working on.

v0.5.0

20 Nov 21:51
Compare
Choose a tag to compare

spOccupancy v0.5.0 contains numerous substantial updates that provide new functionality, improved run times for models with unstructured random effects, an important bug fix for cross-validation with unstructured random effects under certain scenarios, and some other minor bug fixes. The changes include:

  • New functionality for fitting spatially-varying coefficient occupancy models. The function svcPGOcc() fits a single-season spatially-varying coefficient model, and svcTPGOcc() fits a multi-season spatially-varying coefficient model. We also include the functions svcPGBinom() and svcTPGBinom() for fitting spatially-varying coefficient generalized linear models when ignoring imperfect detection. We also include the helper function getSVCSamples() to more easily extract the SVC samples from the resulting model objects if they are desired.
  • Updated the underlying C++ code to reduce run times for models that include unstructured random intercepts.
  • Fixed a bug in the k-fold cross-validation for models that include unstructured random intercepts on the occupancy portion of the model. This bug could have led to inacurrate cross-validation metrics when comparing a model with the unstructured random effect and without the unstructured random effect. We strongly encourage users who have performed cross-validation under such a scenario to rerun their analyses using v0.5.0.
  • Added the k.fold.only argument to all model-fitting functions, which allows users to only perform k-fold cross-validation instead of having to run the model first with the entire data set.
  • Adjusted how random intercepts in the detection model were being calculated, which resulted in unnecessary massive objects when fitting a model with a large number of random effect levels and spatial locations. See GitHub issue 14.
  • Fixed a bug that prevented prediction from working for multi-species models when X.0 was supplied as a data frame and not a matrix. See GitHub issue 13.
  • Fixed an error that occurred when the detection-nondetection data were specified in a specific way. See GitHub issue 12.

v0.4.0

13 Jul 21:13
Compare
Choose a tag to compare

spOccupancy 0.4.0

  • Major new functionality for fitting multi-season (i.e., spatio-temporal) single-species occupancy models using the functions tPGOcc() and stPGOcc().
  • Fixed a bug in calculation of the detection probability values in fitted() functions for all spOccupancy model objects. See this Github issue for more details.
  • Fixed an error that occurred when predicting for multi-species models and setting ignore.RE = TRUE.
  • Fixed other small bugs that caused model fitting functions to break under specific circumstances.

v0.3.0

30 Mar 17:27
Compare
Choose a tag to compare

spOccupancy Version 0.3.0 contains numerous substantial updates that provide new functionality, improved computational performance for model fitting and subsequent model checking/comparison, and minor bug fixes. The changes include:

  • Additional functionality for fitting spatial and non-spatial multi-species occupancy models with residual species correlations (i.e., joint species distribution models with imperfect detection). See documentation for lfMsPGOcc() and sfMsPGOcc(). We also included the functions lfJSDM() and sfJSDM() which are more typical joint species distribution models that fail to explicitly account for imperfect detection.
  • All single-species and multi-species models allow for unstructured random intercepts in both the occurrence and detection portions of the occupancy model. Prior to this version, random intercepts were not supported in the occurrence portion of spatially-explicit models.
  • predict() functions for single-species and multi-species models now include the argument type, which allows for prediction of detection probability (type = 'detection') at a set of covariate values as well as predictions of occurrence (type = 'occupancy').
  • All models are substantially faster than version 0.2.1. We improved performance by implementing a change in how we sample the latent Polya-Gamma variables in the detection component of the model. This results in substantial increases in speed for models where the number of replicates varies across sites. We additionally updated how non-spatial random effects were sampled, which also contributes to improved computational performance.
  • All model fitting functions now include the object like.samples in the resulting model object, which contains model likelihood values needed for calculation of WAIC. This leads to much shorter run times for waicOcc() compared to previous versions.
  • All fitted.*() functions now return both the fitted values and the estimated detection probability samples from a fitted spOccupancy model.
  • Improved error handling for models with missing values and random effects.
  • Added the argument ignore.RE to all predict() functions. If non-spatial random intercepts are included when fitting the model, setting ignore.RE = TRUE will yield predictions that ignore the values of the random effects. If ignore.RE = FALSE, the model will predict new values using the random intercepts for both sampled and non-sampled levels of the effects.
  • Fixed a bug in the cross-validation component of all spOccupancy model fitting functions that occurred when random effects were included in the occurrence and/or detection component of the model.
  • Fixed minor bug in simOcc() and simMsOcc() that prevented simulating data with multiple random intercepts on detection.
  • Fixed minor bug in spatially-explicit models that resulted in an error when setting NNGP = FALSE and not specifying initial values for the spatial range parameter phi.
  • Fixed a bug in the predict() functions for spMsPGOcc and spPGOcc objects that resulted in potentially inaccurate predictions when n.omp.threads > 1.

v0.3.0.9000

21 Jan 15:36
Compare
Choose a tag to compare
v0.3.0.9000 Pre-release
Pre-release

Current development is focused on adding in functionality for computationally efficient spatial and nonspatial multispecies occupancy models that incorporate species interactions. In other words, I am implementing joint species distribution models with imperfect detection, with options for both spatial and non-spatial models.

v0.2.1

21 Jan 15:28
Compare
Choose a tag to compare
v0.2.1