Skip to content

Commit

Permalink
prep for CRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
doserjef committed Sep 26, 2024
1 parent c6ba404 commit f7681fd
Show file tree
Hide file tree
Showing 8 changed files with 257 additions and 233 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Encoding: UTF-8
LazyData: true
URL: https://www.doserlab.com/files/spabundance-web
https://groups.google.com/g/spocc-spabund-users
BugReports: https://github.com/doserjef/spAbundance/issues
BugReports: https://github.com/biodiverse/spAbundance/issues
Depends: R (>= 3.5.0)
Imports:
stats, coda, abind, RANN, lme4, foreach, doParallel, methods
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
+ Fixed some typos in the documentation.
+ Updated C++ code to adhere to the new lack of re-mapping of functions in Rinternals.h and R_ext/Error.h when building packages on CRAN.
+ Fixed a typo in the generation of initial values for latent unstructured random effects in all model functions. The typo had no major ramifications, if anything it just led to slower convergence, as it resulted in very large (or very small) initial values for the latent random effects that are not really viable on the log scale.
+ Moved GitHub development page to the "biodiverse" group. The GitHub link for the development repository is now [https://github.com/biodiverse/spAbundance](https://github.com/biodiverse/spAbundance).


# spAbundance 0.1.3
Expand Down
10 changes: 5 additions & 5 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ knitr::opts_chunk$set(
out.width = "100%")
```

# spAbundance <a href='https://www.doserlab.com/files/spabundance-web/'><img src="man/figures/logo.png" align="right" height="139" width="120"/></a>
# spAbundance <a href='https://doserlab.com/files/spabundance-web/'><img src="man/figures/logo.png" align="right" height="139" width="120"/></a>

[![](http://cranlogs.r-pkg.org/badges/grand-total/spAbundance?color=blue)](https://CRAN.R-project.org/package=spAbundance)
[![CRAN](https://www.r-pkg.org/badges/version/spAbundance)](https://CRAN.R-project.org/package=spAbundance)
[![Codecov test coverage](https://codecov.io/gh/doserjef/spAbundance/branch/main/graph/badge.svg)](https://codecov.io/gh/doserjef/spAbundance?branch=main)
[![Codecov test coverage](https://codecov.io/gh/biodiverse/spAbundance/branch/main/graph/badge.svg)](https://app.codecov.io/gh/biodiverse/spAbundance?branch=main)

`spAbundance` fits univariate (i.e., single-species) and multivariate (i.e., multi-species) spatial N-mixture models, hierarchical distance sampling models, and generalized linear mixed models using Markov chain Monte Carlo (MCMC). Spatial models are fit using Nearest Neighbor Gaussian Processes (NNGPs) to facilitate model fitting to large spatial datasets. `spAbundance` uses analogous syntax to its "sister package" [spOccupancy](https://www.doserlab.com/files/spoccupancy-web/) (Doser et al. 2022). Below we provide a very brief introduction to some of the package's functionality, and illustrate just one of the model fitting functions. For more information, see the resources referenced at the bottom of this page and the "Articles" tab at the top of the page. Please also consider joining the [`spAbundance` and `spOccupancy` users google group](https://groups.google.com/g/spocc-spabund-users).
`spAbundance` fits univariate (i.e., single-species) and multivariate (i.e., multi-species) spatial N-mixture models, hierarchical distance sampling models, and generalized linear mixed models using Markov chain Monte Carlo (MCMC). Spatial models are fit using Nearest Neighbor Gaussian Processes (NNGPs) to facilitate model fitting to large spatial datasets. `spAbundance` uses analogous syntax to its "sister package" [spOccupancy](https://doserlab.com/files/spoccupancy-web/) (Doser et al. 2022). Below we provide a very brief introduction to some of the package's functionality, and illustrate just one of the model fitting functions. For more information, see the resources referenced at the bottom of this page and the "Articles" tab at the top of the page. Please also consider joining the [`spAbundance` and `spOccupancy` users google group](https://groups.google.com/g/spocc-spabund-users).

## Installation

Expand All @@ -30,7 +30,7 @@ install.packages("spAbundance")
To download the development version of the package, you can use `devtools` as follows:

```{r, eval = FALSE}
devtools::install_github("doserjef/spAbundance")
devtools::install_github("biodiverse/spAbundance")
```

Note that because we implement the MCMC in C++, you will need a C++ compiler on your computer to install the package from GitHub. To compile C++ on Windows, you can install [`RTools`](https://cran.r-project.org/bin/windows/Rtools/). To compile C++ on a Mac, you can install `XCode` from the Mac app store.
Expand Down Expand Up @@ -147,7 +147,7 @@ out.pred <- predict(out, X.0, coords.0, verbose = FALSE)

## Learn more

The `vignette("distanceSampling")`, `vignette("nMixtureModels")`, and `vignette("glmm")` provide detailed descriptions and tutorials of all hierarchical distance sampling models, N-mixture models, and generalized linear mixed models in `spAbundance`, respectively. Given the similarity in syntax to fitting occupancy models in the `spOccupancy` package, much of the documentation on the [`spOccupancy` website](https://www.doserlab.com/files/spoccupancy-web/) will also be helpful for fitting models in `spAbundance`. Please also consider joining the [`spAbundance` and `spOccupancy` users google group](https://groups.google.com/g/spocc-spabund-users) to learn from others who use the two packages.
The `vignette("distanceSampling")`, `vignette("nMixtureModels")`, and `vignette("glmm")` provide detailed descriptions and tutorials of all hierarchical distance sampling models, N-mixture models, and generalized linear mixed models in `spAbundance`, respectively. Given the similarity in syntax to fitting occupancy models in the `spOccupancy` package, much of the documentation on the [`spOccupancy` website](https://doserlab.com/files/spoccupancy-web/) will also be helpful for fitting models in `spAbundance`. Please also consider joining the [`spAbundance` and `spOccupancy` users google group](https://groups.google.com/g/spocc-spabund-users) to learn from others who use the two packages.

## Citing `spAbundance`

Expand Down
28 changes: 14 additions & 14 deletions README.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![](http://cranlogs.r-pkg.org/badges/grand-total/spAbundance?color=blue)](https://CRAN.R-project.org/package=spAbundance)
[![CRAN](https://www.r-pkg.org/badges/version/spAbundance)](https://CRAN.R-project.org/package=spAbundance)
[![Codecov test
coverage](https://codecov.io/gh/doserjef/spAbundance/branch/main/graph/badge.svg)](https://codecov.io/gh/doserjef/spAbundance?branch=main)
coverage](https://codecov.io/gh/biodiverse/spAbundance/branch/main/graph/badge.svg)](https://codecov.io/gh/biodiverse/spAbundance?branch=main)

`spAbundance` fits univariate (i.e., single-species) and multivariate
(i.e., multi-species) spatial N-mixture models, hierarchical distance
Expand Down Expand Up @@ -35,7 +35,7 @@ To download the development version of the package, you can use
`devtools` as follows:

``` r
devtools::install_github("doserjef/spAbundance")
devtools::install_github("biodiverse/spAbundance")
```

Note that because we implement the MCMC in C++, you will need a C++
Expand Down Expand Up @@ -160,7 +160,7 @@ summary(out)
#> Thinning Rate: 5
#> Number of Chains: 3
#> Total Posterior Samples: 6000
#> Run Time (min): 0.9219
#> Run Time (min): 0.7582
#>
#> Abundance (log scale):
#> Mean SD 2.5% 50% 97.5% Rhat ESS
Expand Down
42 changes: 21 additions & 21 deletions src/sfMsNMixNNGP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,27 @@ void updateBFSFNMix(double *B, double *F, double *c, double *C, double *coords,
extern "C" {
SEXP sfMsNMixNNGP(SEXP y_r, SEXP X_r, SEXP Xp_r, SEXP coords_r, SEXP XRE_r, SEXP XpRE_r,
SEXP XRandom_r, SEXP XpRandom_r, SEXP yMax_r,
SEXP consts_r, SEXP nAbundRELong_r, SEXP nDetRELong_r,
SEXP m_r, SEXP nnIndx_r,
SEXP nnIndxLU_r, SEXP uIndx_r, SEXP uIndxLU_r, SEXP uiIndx_r,
SEXP betaStarting_r, SEXP alphaStarting_r, SEXP kappaStarting_r, SEXP NStarting_r,
SEXP betaCommStarting_r, SEXP alphaCommStarting_r,
SEXP phiStarting_r, SEXP lambdaStarting_r, SEXP nuStarting_r, SEXP wStarting_r,
SEXP tauSqBetaStarting_r, SEXP tauSqAlphaStarting_r,
SEXP sigmaSqMuStarting_r, SEXP sigmaSqPStarting_r,
SEXP betaStarStarting_r, SEXP alphaStarStarting_r,
SEXP NLongIndx_r, SEXP betaStarIndx_r, SEXP betaLevelIndx_r,
SEXP alphaStarIndx_r, SEXP alphaLevelIndx_r,
SEXP muBetaComm_r, SEXP muAlphaComm_r,
SEXP SigmaBetaComm_r, SEXP SigmaAlphaComm_r, SEXP kappaA_r,
SEXP kappaB_r, SEXP tauSqBetaA_r,
SEXP tauSqBetaB_r, SEXP tauSqAlphaA_r, SEXP tauSqAlphaB_r,
SEXP spatialPriors_r, SEXP sigmaSqMuA_r, SEXP sigmaSqMuB_r,
SEXP sigmaSqPA_r, SEXP sigmaSqPB_r,
SEXP tuning_r, SEXP covModel_r,
SEXP batchInfo_r, SEXP acceptRate_r,
SEXP nThreads_r, SEXP verbose_r, SEXP nReport_r,
SEXP samplesInfo_r, SEXP chainInfo_r, SEXP family_r, SEXP offset_r){
SEXP consts_r, SEXP nAbundRELong_r, SEXP nDetRELong_r,
SEXP m_r, SEXP nnIndx_r,
SEXP nnIndxLU_r, SEXP uIndx_r, SEXP uIndxLU_r, SEXP uiIndx_r,
SEXP betaStarting_r, SEXP alphaStarting_r, SEXP kappaStarting_r, SEXP NStarting_r,
SEXP betaCommStarting_r, SEXP alphaCommStarting_r,
SEXP phiStarting_r, SEXP lambdaStarting_r, SEXP nuStarting_r, SEXP wStarting_r,
SEXP tauSqBetaStarting_r, SEXP tauSqAlphaStarting_r,
SEXP sigmaSqMuStarting_r, SEXP sigmaSqPStarting_r,
SEXP betaStarStarting_r, SEXP alphaStarStarting_r,
SEXP NLongIndx_r, SEXP betaStarIndx_r, SEXP betaLevelIndx_r,
SEXP alphaStarIndx_r, SEXP alphaLevelIndx_r,
SEXP muBetaComm_r, SEXP muAlphaComm_r,
SEXP SigmaBetaComm_r, SEXP SigmaAlphaComm_r, SEXP kappaA_r,
SEXP kappaB_r, SEXP tauSqBetaA_r,
SEXP tauSqBetaB_r, SEXP tauSqAlphaA_r, SEXP tauSqAlphaB_r,
SEXP spatialPriors_r, SEXP sigmaSqMuA_r, SEXP sigmaSqMuB_r,
SEXP sigmaSqPA_r, SEXP sigmaSqPB_r,
SEXP tuning_r, SEXP covModel_r,
SEXP batchInfo_r, SEXP acceptRate_r,
SEXP nThreads_r, SEXP verbose_r, SEXP nReport_r,
SEXP samplesInfo_r, SEXP chainInfo_r, SEXP family_r, SEXP offset_r){

/**********************************************************************
* Initial constants
Expand Down
Loading

0 comments on commit f7681fd

Please sign in to comment.