Skip to content

Commit

Permalink
v0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
doserjef committed Nov 16, 2022
1 parent f974a33 commit 8f137b6
Show file tree
Hide file tree
Showing 7 changed files with 176 additions and 72 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ vignettes/spaceTimeModelsHTML_cache
vignettes/spaceTimeModelsHTML_files
vignettes/svcUnivariate_cache
vignettes/svcUnivariate_files
vignettes/svcUnivariateHTML_cache
vignettes/svcUnivariateHTML_files
*.swp
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ out.pred <- predict(out, X.0, coords.0, verbose = FALSE)

## Learn more

The `vignette("modelFitting")` provides a more detailed description and tutorial of the core functions in `spOccupancy`. For full statistical details on the MCMC samplers for core functions in `spOccupancy`, see `vignette("mcmcSamplers")`. In addition, see [our recent paper](https://doi.org/10.1111/2041-210X.13897) that describes the package in more detail (Doser et al. 2022a). For a detailed description and tutorial of joint species distribution models in `spOccupancy` that account for residual species correlations, see `vignette("factorModels")`, as well as `vignette("mcmcFactorModels")` for full statistical details. For a description and tutorial of multi-season (spatio-temporal) occupancy models in `spOccupancy`, see `vignette("spaceTimeModels")`. For a tutorial on spatially-varying coefficient models in `spOccupancy`, see `vignette("svcUnivariate")` and keep your eyes out for an upcoming preprint providing recommendations and guidelins on using these models.
The `vignette("modelFitting")` provides a more detailed description and tutorial of the core functions in `spOccupancy`. For full statistical details on the MCMC samplers for core functions in `spOccupancy`, see `vignette("mcmcSamplers")`. In addition, see [our recent paper](https://doi.org/10.1111/2041-210X.13897) that describes the package in more detail (Doser et al. 2022a). For a detailed description and tutorial of joint species distribution models in `spOccupancy` that account for residual species correlations, see `vignette("factorModels")`, as well as `vignette("mcmcFactorModels")` for full statistical details. For a description and tutorial of multi-season (spatio-temporal) occupancy models in `spOccupancy`, see `vignette("spaceTimeModels")`. For a tutorial on spatially-varying coefficient models in `spOccupancy`, see `vignette("svcUnivariateHTML")` and keep your eyes out for an upcoming preprint providing recommendations and guidelines on using these models.

## References

Expand Down
32 changes: 16 additions & 16 deletions README.html

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[![](https://www.r-pkg.org/badges/version/spOccupancy?color=green)](https://cran.r-project.org/package=spOccupancy)
[![](http://cranlogs.r-pkg.org/badges/grand-total/spOccupancy?color=blue)](https://cran.r-project.org/package=spOccupancy)
[![](https://app.codecov.io/gh/doserjef/spOccupancy/branch/main/graph/badge.svg)](https://app.codecov.io/gh/doserjef/spOccupancy)
[![](https://codecov.io/gh/doserjef/spOccupancy/branch/main/graph/badge.svg)](https://app.codecov.io/gh/doserjef/spOccupancy)

spOccupancy fits single-species, multi-species, and integrated spatial
occupancy models using Markov Chain Monte Carlo (MCMC). Models are fit
Expand Down Expand Up @@ -138,25 +138,25 @@ summary(out)
#> Thinning Rate: 4
#> Number of Chains: 3
#> Total Posterior Samples: 6000
#> Run Time (min): 1.4622
#> Run Time (min): 1.3664
#>
#> Occurrence (logit scale):
#> Mean SD 2.5% 50% 97.5% Rhat ESS
#> (Intercept) 3.9072 0.5531 2.9995 3.8480 5.1652 1.003 231
#> scale(Elevation) -0.5312 0.2288 -1.0389 -0.5169 -0.1242 1.066 197
#> I(scale(Elevation)^2) -1.1421 0.2103 -1.6240 -1.1224 -0.7848 1.006 399
#> Mean SD 2.5% 50% 97.5% Rhat ESS
#> (Intercept) 4.0331 0.6006 3.0498 3.9614 5.4340 1.0170 227
#> scale(Elevation) -0.5268 0.2141 -0.9579 -0.5239 -0.1184 1.0065 1401
#> I(scale(Elevation)^2) -1.1649 0.2200 -1.6432 -1.1429 -0.7969 1.0095 306
#>
#> Detection (logit scale):
#> Mean SD 2.5% 50% 97.5% Rhat ESS
#> (Intercept) 0.6630 0.1135 0.4420 0.6631 0.8900 1.0001 5363
#> scale(day) 0.2912 0.0707 0.1523 0.2913 0.4315 0.9998 6000
#> scale(tod) -0.0303 0.0695 -0.1674 -0.0300 0.1042 1.0036 6000
#> I(scale(day)^2) -0.0752 0.0858 -0.2398 -0.0763 0.0980 1.0001 6305
#> (Intercept) 0.6619 0.1161 0.4367 0.6614 0.8913 1.0003 6000
#> scale(day) 0.2904 0.0706 0.1540 0.2901 0.4314 1.0016 5671
#> scale(tod) -0.0317 0.0701 -0.1712 -0.0308 0.1044 1.0037 6000
#> I(scale(day)^2) -0.0761 0.0870 -0.2489 -0.0770 0.0966 1.0004 6000
#>
#> Spatial Covariance:
#> Mean SD 2.5% 50% 97.5% Rhat ESS
#> sigma.sq 0.9604 0.8349 0.2008 0.6658 3.3382 1.0317 71
#> phi 0.0082 0.0080 0.0005 0.0047 0.0277 1.1469 50
#> sigma.sq 1.1733 1.1218 0.2066 0.8568 3.6028 1.1142 103
#> phi 0.0093 0.0083 0.0010 0.0056 0.0283 1.1004 99
```

### Posterior predictive check
Expand All @@ -182,7 +182,7 @@ summary(ppc.out)
#> Number of Chains: 3
#> Total Posterior Samples: 6000
#>
#> Bayesian p-value: 0.4852
#> Bayesian p-value: 0.4877
#> Fit statistic: freeman-tukey
```

Expand All @@ -195,7 +195,7 @@ due to Monte Carlo error your results will differ slightly).
``` r
waicOcc(out)
#> elpd pD WAIC
#> -683.85572 19.42422 1406.55989
#> -681.17425 21.95552 1406.25954
```

Alternatively, we can perform k-fold cross-validation (CV) directly in
Expand All @@ -208,7 +208,7 @@ value of this CV score.

``` r
out$k.fold.deviance
#> [1] 1495.816
#> [1] 1495.596
```

### Prediction
Expand Down Expand Up @@ -241,9 +241,9 @@ account for residual species correlations, see
for full statistical details. For a description and tutorial of
multi-season (spatio-temporal) occupancy models in `spOccupancy`, see
`vignette("spaceTimeModels")`. For a tutorial on spatially-varying
coefficient models in `spOccupancy`, see `vignette("svcUnivariate")` and
coefficient models in `spOccupancy`, see `vignette("svcUnivariateHTML")` and
keep your eyes out for an upcoming preprint providing recommendations
and guidelins on using these models.
and guidelines on using these models.

## References

Expand Down
4 changes: 4 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ authors:
template:
bootstrap: 5
reference:
- title: "Package overview"
- contents:
- spOccupancy
- title: "Fitting Models"
- contents:
- PGOcc
Expand Down Expand Up @@ -109,6 +112,7 @@ articles:
- spaceTimeModels
- spaceTimeModelsHTML
- randomEffects
- svcUnivariateHTML
- title: MCMC sampler details
contents:
- mcmcSamplers
Expand Down
101 changes: 101 additions & 0 deletions man/spOccupancy-package.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
\name{spOccupancy-package}
\alias{spOccupancy-package}
\alias{spOccupancy}
\keyword{package}
\title{Single-Species, Multi-Species, and Integrated Spatial Occupancy Models}

\description{
Fits single-species, multi-species, and integrated non-spatial and spatial
occupancy models using Markov Chain Monte Carlo (MCMC). Models are fit using
Polya-Gamma data augmentation detailed in Polson, Scott, and Windle (2013).
Spatial models are fit using either Gaussian processes or Nearest Neighbor
Gaussian Processes (NNGP) for large spatial datasets. Details on NNGPs are
given in Datta, Banerjee, Finley, and Gelfand (2016). Provides functionality
for data integration of multiple single-species occupancy data sets using a
joint likelihood framework. Details on data integration are given in
Miller, Pacifici, Sanderlin, and Reich (2019). Details on single-species and
multi-species models are found in MacKenzie et al. (2002) and Dorazio and Royle (2005),
respectively. Details on the package functionality is given in Doser et al. (2022) and
Doser, Finley, Banerjee (2022). See \code{citation('spOccupancy')} for how to
cite spOccupancy in publications.

\strong{Model Fitting Functions}

\code{\link{PGOcc}} fits single-species occupancy models.

\code{\link{spPGOcc}} fits single-species spatial occupancy models.

\code{\link{msPGOcc}} fits multi-species occupancy models.

\code{\link{spMsPGOcc}} fits multi-species spatial occupancy models.

\code{\link{intPGOcc}} fits single-species integrated occupancy models (i.e., an occupancy model with multiple data sources).

\code{\link{spIntPGOcc}} fits single-species integrated spatial occupancy models.

\code{\link{lfJSDM}} fits a joint species distribution model without imperfect detection.

\code{\link{sfJSDM}} fits a spatial joint species distribution model without imperfect detection.

\code{\link{lfMsPGOcc}} fits a joint species distribution model with imperfect detection (i.e., a multi-species occupancy model with residual species correlations).

\code{\link{sfMsPGOcc}} fits a spatial joint species distribution model with imperfect detection.

\code{\link{tPGOcc}} fits a multi-season single-species occupancy model.

\code{\link{stPGOcc}} fits a multi-season single-species spatial occupancy model.

\code{\link{svcPGBinom}} fits a single-species spatially-varying coefficient GLM.

\code{\link{svcPGOcc}} fits a single-species spatially-varying coefficient occupancy model.

\code{\link{svcTPGBinom}} fits a single-species spatially-varying coefficient multi-season GLM.

\code{\link{svcTPGOcc}} fits a single-species spatially-varying coefficient multi-season occupancy model.


\strong{Goodness of Fit and Model Assessment Functions}

\code{\link{ppcOcc}} performs posterior predictive checks.

\code{\link{waicOcc}} computes the Widely Applicable Information Criterion for spOccupancy model objects.


\strong{Data Simulation Functions}

\code{\link{simOcc}} simulates single-species occupancy data.

\code{\link{simTOcc}} simulates single-species multi-season occupancy data.

\code{\link{simBinom}} simulates detection-nondetection data with perfect detection.


\code{\link{simTBinom}} simulates multi-season detection-nondetection data with perfect detection.

\code{\link{simMsOcc}} simulates multi-species occupancy data.

\code{\link{simIntOcc}} simulates single-species occupancy data from multiple data sources.


All objects from model-fitting functions have support with the \code{summary} function for
displaying a concise summary of model results, the \code{fitted} function for extracting
model fitted values, and the \code{predict} function for predicting occupancy and/or detection
across an area of interest.
}

\references{

Doser, J. W., Finley, A. O., Kéry, M., & Zipkin, E. F. (2022).
spOccupancy: An R package for singlespecies, multispecies, and
integrated spatial occupancy models. Methods in Ecology and Evolution.

Doser, J. W., Finley, A. O., & Banerjee, S. (2022). Joint species
distribution models with imperfect detection for high-dimensional
spatial data. arXiv preprint arXiv:2204.02707.
}

\author{
Jeffrey W. Doser, Andrew O. Finley, Marc Kéry
}

\docType{package}
Loading

0 comments on commit 8f137b6

Please sign in to comment.