Skip to contents

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 or character location of biodiversity point records.

formula

A character or formula object to be passed. Default (NULL) is to use all covariates .

family

A character stating the family to be used (Default: binomial).

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 to 1 if only one dataset is added. A vector 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 a pseudoabs_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

Examples

if (FALSE) { # \dontrun{
 x <- distribution(background) |>
   add_biodiversity_polpa(protectedArea)
} # }