fit_plug_and_play {S4DM} | R Documentation |
Fit presence-background distribution models in a plug-and-play framework.
Description
This function fits presence-background species distribution models for the specified plug-and-play methods (Drake and Richards 2018; Drake 2015).
Usage
fit_plug_and_play(
presence = NULL,
background = NULL,
method = NULL,
presence_method = NULL,
background_method = NULL,
bootstrap = "none",
bootstrap_reps = 100,
...
)
Arguments
presence |
dataframe of covariates at presence points |
background |
Optional. Dataframe of covariates at background points |
method |
Optional. If supplied, both presence and background density estimation will use this method. |
presence_method |
Optional. Method for estimation of presence density. |
background_method |
Optional. Method for estimation of background density. |
bootstrap |
Character. One of "none" (the default, no bootstrapping), "numbag" (presence function is bootstrapped), or "doublebag" (presence and background functions are bootstrapped). |
bootstrap_reps |
Integer. Number of bootstrap replicates to use (default is 100) |
... |
Additional parameters passed to internal functions. |
Details
Current methods include: "gaussian", "kde","vine","rangebagging", "lobagoc", and "none".
Value
List of class "pnp_model" containing model objects and metadata needed for projecting the fitted models.
Note
Either method
or both presence_method
and background_method
must be supplied.
References
Drake JM (2015).
“Range bagging: a new method for ecological niche modelling from presence-only data.”
J. R. Soc. Interface, 12(107).
http://dx.doi.org/10.1098/rsif.2015.0086.
Drake JM, Richards RL (2018).
“Estimating environmental suitability.”
Ecosphere, 9(9), e02373.
https://onlinelibrary.wiley.com/doi/10.1002/ecs2.2373.
Examples
# load in sample data
library(S4DM)
library(terra)
# occurrence points
data("sample_points")
occurrences <- sample_points
# environmental data
env <- rast(system.file('ex/sample_env.tif', package="S4DM"))
# rescale the environmental data
env <- scale(env)
# Get presence environmental data
pres_env <- get_env_pres(coords = occurrences,
env = env)
# Get background environmental data
bg_env <- get_env_bg(coords = occurrences,
env = env,width = 100000)
# Note that the functions to get the environmental data return lists,
# and only the "env" element of these is used in the fit function
kde_fit <- fit_plug_and_play (presence = pres_env$env,
background = bg_env$env,
method = "kde")