spOccupancy
(and
spAbundance
), please use the new spOccupancy/spAbundance
mailing list.tIntPGOcc()
fits
a non-spatial multi-season integrated occupancy model,
stIntPGOcc()
fits a spatial multi-season integrated
occupancy model, and svcTIntPGOcc()
fits a
spatially-varying coefficient multi-season occupancy model. Random
intercepts are supported in both the occurrence and detection formulas
for both model types. I am behind on adding vignettes for some of the
newer functionality (sorry!), but adding a vignette for this new
functionality is on my todo list. If interested in using these functions
and you’re having problems fitting them, please send your questions to
the mailing list.intPGOcc()
and spIntPGOcc()
) using
lme4
syntax (e.g., (1 | observer)
for a random
effect of observer).simTIntPGOcc()
is a new function that allows simulation
of single-species multi-season detection-nondetection data from multiple
data sources.simMsIntPGOcc()
to now include simulation of
data sets with spatially-varying coefficients and unstructured random
effects on both occurrence and detection.spIntPGOcc()
with NNGP = TRUE
and using cross-validation, I suggest
re-running the analysis. Apologies for the inconvenience.residuals()
function to extract occupancy
and detection residuals following the approach of Wilson
et al. (2019) for single-season, single-species occupancy models
(functions PGOcc()
, spPGOcc()
, and
svcPGOcc()
). I’m hoping to implement this for all model
functions and improve GoF functionality. If anyone has any interest in
helping out with this, then please let me know!waicOcc()
for integrated single-species models is now
substantially faster.updateMCMC()
now works with lfJSDM.updateMCMC()
that prevented it from
working with spAbundance::msAbund()
when there were random
effects in the model. Also added the save.fitted
argument
to updateMCMC()
to allow it to work with
msAbund()
and not save the replicate/fitted data values in
cases where the amount of RAM is an important consideration.include.w
argument in the
predict()
function for lfMsPGOcc()
models that
enables predicting without the latent factors. This also allows
prediction to occur without needing to supply the coordinates, which is
useful when generating conditional probability plots.lfJSDM()
to give an error more quickly when
there are memory limitations.svcTPGOcc
models that required updating v0.7.3 on CRAN to
pass valgrind checks, as well as a memory leak in the calculation of the
nearest neighbors, and a small problem with the DESCRIPTION file for
including on CRAN.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.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.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
.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.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.k.fold.>.
Thanks to Zack Steel for pointing this out.
plot()
function to
generate simple traceplots using spOccupancy
model objects.
Details can be found in the help page (e.g., for spPGOcc
models, type ?plot.spPGOcc
in the console).spOccupancy
. Thanks to Sara Stoudt for writing this!lfJSDM()
without residual
species correlations by setting n.factors = 0
. This is a
model analogous to msPGOcc()
, but without the detection
component.shared.spatial
argument to
sfJSDM()
. If set to TRUE
, this argument
estimates a common spatial process for all species instead of using the
default spatial factor modeling approach.predict.svcTMsPGOcc()
when same variable
was used for a fixed and random effect (e.g., if including a linear year
trend and also an unstructured random intercept for year). Thanks to
Liam Kendall for pointing this out.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.
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.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.simTMsOcc()
simulates multi-season,
multi-species occupancy models.getSVCSamples()
to now work with multi-species
spatially-varying coefficient models.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.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.by.sp
argument to waicOcc()
to allow users to calculate WAIC separately for individual species in
all multi-species model types in spOccupancy
.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. See vignette("integratedMultispecies")
for more
details.postHocLM()
. The function
postHocLM()
fits a basic linear (mixed) model to a response
variable that is assumed to come from a previous model fit, and thus
each value in the data response variable has a full set of posterior
MCMC samples associated with it. While this function can be used for a
variety of situations (including objects that don’t come from
spOccupancy
), postHocLM()
may be particularly
useful for use with multi-species occupancy models to explore
associations between species-specific covariate effect estimates from a
multi-species occupancy model with species-level covariates, while fully
accounting for uncertainty in the estimates. A vignette displaying how
to do this will be posted in the coming months, but see the
documentation for the function for basic instructions on how to use the
function.sfMsPGOcc()
to allow a half-t prior on the
community-level variance parameters. See documentation for more
information on how to specify this. All multi-species occupancy model
fitting functions will eventually be updated to allow for this prior,
which can be a less informative prior when sample sizes (i.e., the
number of species in this case) is low.intPGOcc()
and spIntPGOcc()
to
remove an error that may occur if a data set only has site level
detection covariates.getSVCSamples()
to eliminate errors that
prevented the function from working under certain circumstances
depending on which covariates in the design matrix were modelled as
spatially-varying coefficients.tPGOcc()
and stPGOcc()
to
eliminate an error that occurred when trying to run these models with
single-visit data sets.mis.spec.type
and scale.param
arguments to the simTOcc()
function to simulate
multi-season detection-nondetection data under varying forms of model
mis-specification. See simTOcc()
documentation for detials.
Thanks to Sara Stoudt for her help with this.ppcOcc()
from working when
there were only site-level random effects on detection. This also
sometimes caused problems with cross-validation functionality as well.
Thanks to Jose Luis Mena for bringing this to my attention.spOccupancy v0.5.2 contains an important bug fix in the
cross-validation functionality for single-season occupancy models with
unbalanced sampling across replicates in the data set. Specifically, the
reported cross-validation deviance metrics may be inaccurate when one or
more sites had a detection history where a missing value came before a
non-missing value. For example, if one or more sites had a detection
history of c(NA, 1, 0, 0, 1)
, this would lead to the
problem occurring, but this would not occur if all missing values were
at the end of the detection history (e.g.,
c(1, 0, 0, 1, NA)
). The affected functions include the
following: PGOcc()
, spPGOcc()
,
msPGOcc()
, spMsPGOcc()
,
lfMsPGOcc()
, sfMsPGOcc()
,
intPGOcc()
, spIntPGOcc()
. We strongly
encourage users who have performed cross-validation with these models
and unbalanced sampling across replicates in the manner described to
rerun their analyses using v0.5.2. We apologize for any troubles this
has caused.
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:
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.C++
code to reduce run times for
models that include unstructured random intercepts.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.X.0
was supplied as a data frame and not a
matrix. See GitHub issue
13.tPGOcc()
and stPGOcc()
.fitted()
functions for all spOccupancy model objects. See
this
Github issue for more details.ignore.RE = TRUE
.waicOcc()
for integrated models
(intPGOcc()
and spIntPGOcc()
) that sometimes
resulted in incorrect estimates of WAIC for data sets other than the
first data set. We strongly encourage users who have used
waicOcc()
with an integrated model to rerun their analyses
using v0.3.2.predict()
on a
spatially-explicit model with non-spatial random effects in the
occurrence portion of the model to rerun their analyses using
v0.3.2.intPGOcc()
and
spIntPGOcc()
that were accidentally introduced in v0.3.0.
See this
Github issue for more details.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:
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.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'
).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.fitted.*()
functions now return both the fitted
values and the estimated detection probability samples from a fitted
spOccupancy
model.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.spOccupancy
model fitting functions that occurred when
random effects were included in the occurrence and/or detection
component of the model.simOcc()
and simMsOcc()
that prevented simulating data with multiple random intercepts on
detection.NNGP = FALSE
and not specifying initial
values for the spatial range parameter phi
.predict()
functions for
spMsPGOcc
and spPGOcc
objects that resulted in
potentially inaccurate predictions when n.omp.threads
>
1.n.chains
argument to all model-fitting
functions for running multiple chains in sequence.summary
displays
for each model-fitting function.predict
functions to return
occurrence probabilities at sampled sites instead of NAs.spOccupancy
.