Pseudo absences generation
Supported algorithms
PseudoAbsences.PseudoAbsenceGenerator Type
PseudoAbsenceGeneratorAbstract 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.
sourcePseudoAbsences.WithinRadius Type
WithinRadiusGenerates pseudo-absences within a set radius (in kilometers) around each occurrence. Internally, this relies on DistanceToEvent.
PseudoAbsences.SurfaceRangeEnvelope Type
SurfaceRangeEnvelopeGenerates pseudo-absences at random within the geographic range covered by actual occurrences. Cells with presences cannot be part of the background sample.
sourcePseudoAbsences.RandomSelection Type
RandomSelectionGenerates 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.
sourceGeneration 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
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.
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
sourcepseudoabsencemask( ::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).
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.
Sampling of background points
PseudoAbsences.backgroundpoints Function
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.