Add biodiversity polygon dataset to a distribution object (presence-absence)
Source:R/add_biodiversity.R
add_biodiversity_polpa.Rd
This function can be used to add a sf
polygon dataset to an
existing distribution object. Presence-absence polygon data assumes that each
area within the polygon can be treated as 'presence' for the species, while
each area outside the polygon is where the species is absent.
Usage
add_biodiversity_polpa(
x,
polpa,
name = NULL,
field_occurrence = "observed",
formula = NULL,
family = "binomial",
link = NULL,
weight = 1,
simulate = FALSE,
simulate_points = 100,
simulate_bias = NULL,
simulate_strategy = "random",
separate_intercept = TRUE,
docheck = TRUE,
pseudoabsence_settings = NULL,
...
)
# S4 method for class 'BiodiversityDistribution,sf'
add_biodiversity_polpa(
x,
polpa,
name = NULL,
field_occurrence = "observed",
formula = NULL,
family = "binomial",
link = NULL,
weight = 1,
simulate = FALSE,
simulate_points = 100,
simulate_bias = NULL,
simulate_strategy = "random",
separate_intercept = TRUE,
docheck = TRUE,
pseudoabsence_settings = NULL,
...
)
Arguments
- x
distribution()
(i.e.BiodiversityDistribution
) object.- polpa
A
sf
polygon object of presence-absence occurrences.- name
The name of the biodiversity dataset used as internal identifier.
- field_occurrence
A
numeric
orcharacter
location of biodiversity point records.- formula
A
character
orformula
object to be passed. Default (NULL
) is to use all covariates .- family
A
character
stating the family to be used (Default:binomial
).- link
A
character
to overwrite the default link function (Default:NULL
).- weight
A
numeric
value acting as a multiplier with regards to any weights used in the modelling. Larger weights indicate higher weighting relative to any other datasets. By default set to1
if only one dataset is added. Avector
is also supported but must be of the same length as"polpa"
.- simulate
Simulate poipa points within its boundaries. Result are passed to
add_biodiversity_poipa
(Default:FALSE
).- simulate_points
A
numeric
number of points to be created by simulation.- simulate_bias
A
SpatRaster
layer describing an eventual preference for simulation (Default:NULL
).- simulate_strategy
A
character
stating the strategy for sampling. Can be set to either.'random'
or'regular'
, the latter requiring a raster supplied in the'simulate_weights'
parameter.- separate_intercept
A
logical
value stating whether a separate intercept is to be added in shared likelihood models for engines engine_inla, engine_inlabru and engine_stan.- docheck
logical
on whether additional checks should be performed (e.g. intersection tests) (Default:TRUE
).- pseudoabsence_settings
Either
NULL
or apseudoabs_settings()
created settings object.- ...
Other parameters passed down.
Value
Adds biodiversity data to distribution object.
Details
The default approach for polygon data is to sample presence-absence
points across the region of the polygons. This function thus adds as a
wrapper to add_biodiversity_poipa()
as presence-only points are created
by the model. Note if the polygon is used directly in the modelling the
link between covariates and polygonal data is established by regular
sampling of points within the polygon and is thus equivalent to simulating
the points directly.
For an integration of range data as predictor or offset, see add_predictor_range()
and add_offset_range()
instead.
See also
Other add_biodiversity:
add_biodiversity_poipa()
,
add_biodiversity_poipo()
,
add_biodiversity_polpo()
Examples
if (FALSE) { # \dontrun{
x <- distribution(background) |>
add_biodiversity_polpa(protectedArea)
} # }