Comments (6)
Brilliant - thanks! Yeah, I'm mainly interested in using INLA for the integrated modelling, so understanding how it uses the mesh and how that relates to psuedo-absences was my main question/uncertainty here. Sorry, I should have been more explicit about that in the original post.
from ibis.isdm.
For example, here's a reprex, where I try to manually specify pseudo-absences for a PPM model. It just occurred to me - I'm assuming PPM models actually use pseudo-absences, maybe I've got this wong and they don't use pseudo-absences so my question is invalid (e.g., something like asking "what is the best way to remove the scales from a bear? what do you mean, bears don't scales...")
# load packages
library(ibis.iSDM)
# load data
bg_data <-
system.file("extdata/europegrid_50km.tif", package = "ibis.iSDM") |>
terra::rast()
spp_data <-
system.file("extdata/input_data.gpkg", package = "ibis.iSDM") |>
sf::read_sf()
env_data <-
system.file("extdata/predictors/", package = "ibis.iSDM") |>
list.files("*.tif", full.names = TRUE) |>
terra::rast()
# add pseudo-absences
psa_sett <- pseudoabs_settings(background = bg_data, nrpoints = 200, method = "random")
spp_data2 <- add_pseudoabsence(df = spp_data, field_occurrence = "Observed", settings = psa_sett)
# define model specification
model <-
distribution(bg_data) |>
add_predictors(env = env_data, transform = "scale", derivates = "none") |>
add_biodiversity_poipo(spp_data2, field_occurrence = "Observed") |>
engine_inlabru()
#> [Setup] 2024-02-02 11:55:49.360766 | Provide a background with a valid projection!
#> [Setup] 2024-02-02 11:55:49.376749 | Creating distribution object...
#> [Setup] 2024-02-02 11:55:49.41185 | Adding predictors...
#> [Setup] 2024-02-02 11:55:49.413278 | Transforming predictors...
#> [Setup] 2024-02-02 11:55:49.484272 | Adding poipo dataset...
#> [Setup] 2024-02-02 11:55:49.651038 | Absence points found. Potentially this data needs to be added as presence-absence instead?
from ibis.isdm.
Heya,
a few things:
- In your example you are taking a presence-only dataset and manually add pseudo-absence points to it. This changes the dataset to a presence-absence dataset and during model building the package correctly complains that there are Absence points found. If you want to manually add absence-points prior to fitting, then add the biodiversity dataset via
add_biodiversity_poipa()
instead of withadd_biodiversity_poipo()
- There are some basic plotting functionalities in any BiodiversityDataset which you can simply access via
x$plot()
. For example if points are added as presence-absence in your above example this looks like this
model <-
distribution(bg_data) |>
add_predictors(env = env_data, transform = "scale", derivates = "none") |>
add_biodiversity_poipa(spp_data2, field_occurrence = "Observed") |>
engine_inlabru()
model$biodiversity$plot()
-
If you need to control any pseudo-absence generation in
add_biodiversity_poipo()
you could pass a specific Settings object (created withpseudoabs_settings()
there to the parameterpseudoabsence_settings
). This changes the default behaviour for sampling any pseudo-absence data throughout. INLA for example treats every single node on a mesh that as background by default for any lgcp inferences... -
If you want to access the biodiversity data in your model object, this can be found in model$biodiversity. The respective functions for this (sorry for missing documentation still) would be to first query the id of the dataset and then return the data as
sf
object.
Example:
model$biodiversity$get_data( model$biodiversity$get_ids()[[1]] )
Similar ways exist to query the point data from fitted DistributionModel objects by looking within thefit$model$biodiversity
object which contains all data used for inference.
Hope that helps.
from ibis.isdm.
Thanks for explaining all that - that's really helpful!
Just to clarify, if I'm using presence-only data (via add_biodiversity_poipo())
with the inlabru engine (via engine_inlabru()
), then the INLA mesh is used for the pseudo-absence points and the pseudoabsence_settings
parameter of add_biodiversity_poipo()
is ignored?
from ibis.isdm.
Thanks for explaining all that - that's really helpful!
Just to clarify, if I'm using presence-only data (via
add_biodiversity_poipo())
with the inlabru engine (viaengine_inlabru()
), then the INLA mesh is used for the pseudo-absence points and thepseudoabsence_settings
parameter ofadd_biodiversity_poipo()
is ignored?
For INLA So far yes (code starting here), although I think this can actually be passed on as well somehow via method stack. TBD when I have time to think about the other INLA issue.
Will report back.
For other engines this is already the default behaviour (for a Bayesian engine you could try it out with engine_breg()
and a single data type).
from ibis.isdm.
Aye, understand. INLA has so far been the hardest to maintain thus the many changes and relatively messy code still :D
from ibis.isdm.
Related Issues (20)
- integrated SDM predicts near-zeros across most of study area HOT 6
- Question: How to make predictions over smaller spatial domain, or on a new set of predictor rasters. HOT 5
- Issue with GDP priors and custom formula HOT 5
- Issue with `project()` when used with integrated model HOT 9
- Trouble running models with engine_bart - additional documentation available? HOT 2
- INLA/INLABRU engines option
- Integration several datasets HOT 5
- Partial (and spartial) calculations of glmnet seem to ignore lambda
- Improvements thin_observations HOT 2
- Implemement a (Deep) Neural Network as engine in ibis
- Support for compositing of threshold values via `ensemble`
- Convenience function to support a PCA based Niche overview as graphical plot HOT 5
- Implement spatial block-validation in `ibis.iSDM` ?
- Error with `distribution()` if `getOption("ibis.setupmessages")` is NULL HOT 6
- Unclear warning log message with `distribution()` HOT 4
- Possible typo in FAQ HOT 1
- Error with `train()` when using INLA with `add_biodiversity_poipa()` and weights HOT 7
- Importing of terra and sf HOT 1
- Prediction raster from `train()` does not spatially conform with `distribution()` background HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ibis.isdm.