View source: R/fit_plug_and_play.R
fit_plug_and_play | R Documentation |
This function fits presence-background species distribution models for the specified plug-and-play methods \insertCiteDrake2018-ha,Drake2015-sbS4DM.
fit_plug_and_play(
presence = NULL,
background = NULL,
method = NULL,
presence_method = NULL,
background_method = NULL,
bootstrap = "none",
bootstrap_reps = 100,
...
)
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. |
Current methods include: "gaussian", "kde","vine","rangebagging", "lobagoc", and "none".
List of class "pnp_model" containing model objects and metadata needed for projecting the fitted models.
Either method
or both presence_method
and background_method
must be supplied.
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.