Skip to content

Pseudo absences generation

Supported algorithms

PseudoAbsences.PseudoAbsenceGenerator Type
julia
PseudoAbsenceGenerator

Abstract type to which all of the pseudo-absences generator types belong. Note that the pseudo-absence types are singleton types, and the arguments are passed when generating the pseudo-absence mask.

source
PseudoAbsences.WithinRadius Type
julia
WithinRadius

Generates pseudo-absences within a set radius (in kilometers) around each occurrence. Internally, this relies on DistanceToEvent.

source
PseudoAbsences.SurfaceRangeEnvelope Type
julia
SurfaceRangeEnvelope

Generates pseudo-absences at random within the geographic range covered by actual occurrences. Cells with presences cannot be part of the background sample.

source
PseudoAbsences.RandomSelection Type
julia
RandomSelection

Generates pseudo-absences at random within the layer. The full extent is considered, and cells with a true value cannot be part of the background sample.

source

Generation of a pseudo-absence mask

The above algorithms are used in conjunction with pseudoabsencemask to generate a Boolean layer that contains all pixels in which a background point can be. They do not generate background points directly, in order to allow more flexible workflows based on clipping Boolean masks, for example.

PseudoAbsences.pseudoabsencemask Function
julia
pseudoabsencemask(::Type{RandomSelection}, presences::SDMLayer{Bool})

Generates a mask for pseudo-absences using the random selection method. Candidate cells for the pseudo-absence mask are (i) within the bounding box of the layer (use SurfaceRangeEnvelope to use the presences bounding box), and (ii) valued in the layer.

source
julia
pseudoabsencemask(::Type{SurfaceRangeEnvelope}, presences::SDMLayer{Bool})

Generates a mask from which pseudo-absences can be drawn, by picking cells that are (i) within the bounding box of occurrences, (ii) valued in the layer, and (iii) not already occupied by an occurrence

source
julia
pseudoabsencemask( ::Type{DistanceToEvent}, presences::SDMLayer{Bool}; f = minimum, )

Generates a mask for pseudo-absences using the distance to event method. Candidate cells are weighted according to their distance to a known observation, with far away places being more likely. Depending on the distribution of distances, it may be a very good idea to flatten this layer using log or an exponent. The f function is used to determine which distance is reported (minimum by default, but can be any other relevant function).

source
julia
pseudoabsencemask(::Type{WithinRadius}, presences::SDMLayer{Bool}; distance::Number = 100.0, )

Generates a mask for pseudo-absences where pseudo-absences can be within a distance (in kilometers) of the original observation. Internally, this uses DistanceToEvent.

source

Sampling of background points

PseudoAbsences.backgroundpoints Function
julia
backgroundpoints(layer::T, n::Int; kwargs...) where {T <: SimpleSDMLayer}

Generates background points based on a layer that gives the weight of each cell in the final sample. The additional keywords arguments are passed to StatsBase.sample, which is used internally. This includes the replace keyword to determine whether sampling should use replacement.

source