Skip to contents

This function can be used to add a sf polygon dataset to an existing distribution object. Presence-only polygon data is treated differential than point data in some engines particular through the way that points are generated.

Usage

add_biodiversity_polpo(
  x,
  polpo,
  name = NULL,
  field_occurrence = "observed",
  formula = NULL,
  family = "poisson",
  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 BiodiversityDistribution,sf
add_biodiversity_polpo(
  x,
  polpo,
  name = NULL,
  field_occurrence = "observed",
  formula = NULL,
  family = "poisson",
  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.

polpo

A sf polygon object of presence-only 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 is to use all covariates (if specified).

family

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

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 to 1 if only one dataset is added. A vector is also supported but must be of the same length as "polpo".

simulate

Simulate poipo points within its boundaries. Result are passed to add_biodiversity_poipo (Default: FALSE).

simulate_points

A numeric number of points to be created by simulation (Default: 100).

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-only points across the region of the polygons. This function thus adds as a wrapper to add_biodiversity_poipo() as presence-only points are created by the model. If no points are simulated directly (Default) then the polygon is processed by train() by creating regular point data over the supplied predictors.

Use add_biodiversity_polpa() to create binomial distributed inside-outside points for the given polygon!

For an integration of range data as predictor or offset, see

add_predictor_range() and add_offset_range() instead.

See also

Examples

if (FALSE) {
 x <- distribution(mod) |>
   add_biodiversity_polpo(protectedArea)
}