pointedsdms

Wrapper function for 'inlabru' for modeling species distribution models from disparate datasets.

https://github.com/philipmostert/pointedsdms

Science Score: 59.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: wiley.com, zenodo.org
  • Committers with academic emails
    41 of 44 committers (93.2%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (18.1%) to scientific vocabulary
Last synced: 6 months ago · JSON representation

Repository

Wrapper function for 'inlabru' for modeling species distribution models from disparate datasets.

Basic Info
  • Host: GitHub
  • Owner: PhilipMostert
  • Language: R
  • Default Branch: main
  • Size: 19.3 MB
Statistics
  • Stars: 26
  • Watchers: 4
  • Forks: 6
  • Open Issues: 5
  • Releases: 4
Created almost 5 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# PointedSDMs



[![R-CMD-check](https://github.com/PhilipMostert/PointedSDMs/actions/workflows/R-CMD-check.yaml/badge.svg?branch=main)](https://github.com/PhilipMostert/PointedSDMs/actions/workflows/R-CMD-check.yaml)[![Codecov test coverage](https://codecov.io/gh/PhilipMostert/PointedSDMs/branch/main/graph/badge.svg)](https://app.codecov.io/gh/PhilipMostert/PointedSDMs?branch=ChangingToR6) [![DOI](https://zenodo.org/badge/368823136.svg)](https://zenodo.org/badge/latestdoi/368823136)



The goal of *PointedSDMs* is to simplify the construction of integrated species distribution models (ISDMs) for large collections of heterogeneous data. It does so by building wrapper functions around [inlabru](https://besjournals.onlinelibrary.wiley.com/doi/abs/10.1111/2041-210X.13168), which uses the [INLA methodology](https://rss.onlinelibrary.wiley.com/doi/abs/10.1111/j.1467-9868.2008.00700.x) to estimate a class of latent Gaussian models.

## Installation

You can install the development version of PointedSDMs from [GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
devtools::install_github("PhilipMostert/PointedSDMs")
```

or directly through CRAN using:

``` r
install.packages('PointedSDMs')
```

## Package functionality

*PointedSDMs* includes a selection of functions used to streamline the construction of ISDMs as well and perform model cross-validation. The core functions of the package are:

| Function name | Function description |
|-------------------|-----------------------------------------------------|
| `startISDM()` | Initialize and specify the components used in the integrated model. |
| `startSpecies()` | Initialize and specify the components used in the multi-species integrated model. |
| `blockedCV()` | Perform spatial blocked cross-validation. |
| `fitISDM()` | Estimate and preform inference on the integrated model. |
| `datasetOut()` | Perform dataset-out cross-validation, which calculates the impact individual datasets have on the full model. |

The function `intModel()` produces an [R6](https://github.com/r-lib/R6) object, and as a result there are various *slot functions* available to further specify the components of the model. These *slot functions* include:

| `intModel()` slot function | Function description |
|--------------------|----------------------------------------------------|
| `` `.$help()` `` | Show documentation for each of the slot functions. |
| `` `.$plot()` `` | Used to create a plot of the available data. The output of this function is an object of class [`gg`](https://github.com/tidyverse/ggplot2). |
| `` `.$addBias()` `` | Add an additional spatial field to a dataset to account for sampling bias in unstructured datasets. |
| `` `.$updateFormula()` `` | Used to update a formula for a process. The idea is to start specify the full model with `startISDM()`, and then thin components per dataset with this function. |
| `` `.$updateComponents()` `` | Change or add new components used by [inlabru](https://besjournals.onlinelibrary.wiley.com/doi/abs/10.1111/2041-210X.13168) in the integrated model. |
| `` `.$priorsFixed()` `` | Change the specification of the prior distribution for the fixed effects in the model. |
| `` `.$specifySpatial()` `` | Specify the spatial field in the model using penalizing complexity (PC) priors. |
| `` `.$spatialBlock()` `` | Used to specify how the points are spatially blocked. Spatial cross-validation is subsequently performed using `blockedCV()`. |
| `` `.$addSamplers()` `` | Function to add an integration domain for the PO datasets. |
| `` `.$specifyRandom()` `` | Specify the priors for the random effects in the model. |
| `` `.$changeLink()` `` | Change the link function of a process. |

## Example

This is a basic example which shows you how to specify and run an integrated model, using three disparate datasets containing locations of the solitary tinamou (*Tinamus solitarius)*.

```{r setup, include=FALSE}
knitr::opts_chunk$set(warning = FALSE, message = FALSE) 
```

```{r example}

library(PointedSDMs)
library(ggplot2)
library(terra)

```

```{r data}

bru_options_set(inla.mode = "experimental")

#Load data in

data("SolitaryTinamou")

projection <- "+proj=longlat +ellps=WGS84"

species <- SolitaryTinamou$datasets

covariates <- terra::rast(system.file('extdata/SolitaryTinamouCovariates.tif', 
                                      package = "PointedSDMs"))

mesh <- SolitaryTinamou$mesh


```

Setting up the model is done easily with `startISDM()`, where we specify the required components of the model:

```{r intModel, message = FALSE, warning = FALSE}

#Specify model -- here we run a model with one spatial covariate and a shared spatial field

model <- startISDM(species, spatialCovariates = covariates,
                 Projection = projection, Mesh = mesh, responsePA = 'Present')

```

We can also make a quick plot of where the species are located using `` `.$plot()` ``:

```{r plot, warning = FALSE, message = FALSE, fig.width=8, fig.height=5}

region <- SolitaryTinamou$region

model$plot(Boundary = FALSE) + 
  geom_sf(data = st_boundary(region))

```

To improve stability, we specify priors for the intercepts of the model using `` `.$priorsFixed()` ``

```{r specifyPriors}

model$priorsFixed(Effect = 'Intercept',
                  mean.linear = 0, 
                  prec.linear = 1)

```

And *PC* priors for the spatial field using `` `.$specifySpatial()` ``:

```{r specifySpatial}

model$specifySpatial(sharedSpatial = TRUE,
                     prior.range = c(0.2, 0.1),
                     prior.sigma = c(0.1, 0.1))

```

We can then estimate the parameters in the model using the `fitISDM()` function:

```{r fitISDM, warning = FALSE, message = FALSE}

modelRun <- fitISDM(model, options = list(control.inla = 
                                            list(int.strategy = 'eb'), 
                                          safe = TRUE))
summary(modelRun)

```

*PointedSDMs* also includes generic predict and plot functions:

```{r predict_and_plot, warning = FALSE, message = FALSE, fig.width=8, fig.height=5}

predictions <- predict(modelRun, mesh = mesh,
                       mask = region, 
                       spatial = TRUE,
                       fun = 'linear')

plot(predictions, variable = c('mean', 'sd'))

```

Owner

  • Name: Philip Mostert
  • Login: PhilipMostert
  • Kind: user
  • Location: Trondheim, Norway
  • Company: Norwegian University of Science and Technology

GitHub Events

Total
  • Create event: 2
  • Release event: 1
  • Issues event: 15
  • Watch event: 3
  • Issue comment event: 16
  • Push event: 30
  • Pull request event: 2
  • Fork event: 1
Last Year
  • Create event: 2
  • Release event: 1
  • Issues event: 15
  • Watch event: 3
  • Issue comment event: 16
  • Push event: 30
  • Pull request event: 2
  • Fork event: 1

Committers

Last synced: 6 months ago

All Time
  • Total Commits: 1,354
  • Total Committers: 44
  • Avg Commits per committer: 30.773
  • Development Distribution Score (DDS): 0.623
Past Year
  • Commits: 48
  • Committers: 3
  • Avg Commits per committer: 16.0
  • Development Distribution Score (DDS): 0.188
Top Committers
Name Email Commits
Philip Mostert p****t@n****o 511
Philip Mostert p****m@d****o 69
Philip Mostert p****m@d****o 62
Philip Mostert p****m@d****o 54
Philip Mostert p****m@d****o 52
Philip Mostert p****m@d****o 52
Philip Mostert p****m@d****o 50
Philip Mostert p****m@d****o 48
Philip Mostert p****m@d****o 45
Philip Mostert p****m@d****o 42
Philip Mostert p****m@P****l 37
Philip Mostert p****m@d****o 36
Philip Mostert p****m@d****o 32
Philip Mostert p****m@d****o 26
Philip Mostert p****m@d****o 25
Philip Mostert p****m@d****o 24
Philip Mostert p****m@d****o 19
Philip Mostert p****m@d****o 17
Philip Mostert p****m@d****o 17
Philip Mostert p****m@d****o 16
Philip Mostert p****m@d****o 15
Philip Mostert p****m@d****o 14
Philip Mostert p****m@d****o 12
Philip Mostert p****m@d****o 12
Philip Mostert p****m@d****o 10
Philip Mostert p****m@d****o 9
Philip Mostert p****m@d****o 7
Finn Lindgren F****n@g****m 6
Philip Mostert p****m@d****o 4
RRTogunov r****v@g****m 3
and 14 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 25
  • Total pull requests: 2
  • Average time to close issues: 26 days
  • Average time to close pull requests: about 13 hours
  • Total issue authors: 15
  • Total pull request authors: 2
  • Average comments per issue: 2.6
  • Average comments per pull request: 1.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 10
  • Pull requests: 1
  • Average time to close issues: 18 days
  • Average time to close pull requests: about 20 hours
  • Issue authors: 5
  • Pull request authors: 1
  • Average comments per issue: 1.7
  • Average comments per pull request: 1.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • rondon-d (4)
  • melissaminter1602 (4)
  • klaassenmo (3)
  • RRTogunov (3)
  • sjbonner (2)
  • lgamador (1)
  • harshadkarandikar (1)
  • ManuelSpinola (1)
  • rsbivand (1)
  • hrlai (1)
  • oharar (1)
  • RPJorge (1)
  • laurawhipple (1)
  • cmsp501-commits (1)
  • BrentPease1 (1)
Pull Request Authors
  • finnlindgren (2)
  • RRTogunov (2)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 3
  • Total downloads:
    • cran 159 last-month
  • Total dependent packages: 1
    (may contain duplicates)
  • Total dependent repositories: 1
    (may contain duplicates)
  • Total versions: 15
  • Total maintainers: 1
proxy.golang.org: github.com/PhilipMostert/PointedSDMs
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
proxy.golang.org: github.com/philipmostert/pointedsdms
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
cran.r-project.org: PointedSDMs

Fit Models Derived from Point Processes to Species Distributions using 'inlabru'

  • Versions: 13
  • Dependent Packages: 1
  • Dependent Repositories: 1
  • Downloads: 159 Last month
Rankings
Stargazers count: 10.9%
Dependent packages count: 18.1%
Forks count: 21.0%
Average: 23.6%
Dependent repos count: 23.8%
Downloads: 44.3%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 4.1 depends
  • ggplot2 * depends
  • inlabru >= 2.5 depends
  • methods * depends
  • stats * depends
  • R.devices * imports
  • R6 * imports
  • blockCV * imports
  • raster * imports
  • sp >= 1.4 imports
  • INLA >= 21.08.31 suggests
  • RColorBrewer * suggests
  • USAboundaries * suggests
  • covr * suggests
  • cowplot * suggests
  • ggmap * suggests
  • ggpolypath * suggests
  • kableExtra * suggests
  • knitr * suggests
  • rasterVis * suggests
  • rmarkdown * suggests
  • sf * suggests
  • sn * suggests
  • spocc * suggests
  • testthat >= 3.0.0 suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v2 composite
  • actions/upload-artifact main composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v1 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r v1 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc v1 composite
  • r-lib/actions/setup-r v1 composite
  • r-lib/actions/setup-r-dependencies v1 composite
.github/workflows/pr-commands.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/pr-fetch v1 composite
  • r-lib/actions/pr-push v1 composite
  • r-lib/actions/setup-r v1 composite
  • r-lib/actions/setup-r-dependencies v1 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc v1 composite
  • r-lib/actions/setup-r v1 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite