| bm_BinaryTransformation {biomod2} | R Documentation |
Convert probability values into binary values using a predefined threshold
Description
This internal biomod2 function allows to convert probability (not necessary
between 0 and 1) values into binary presence-absence (0 or 1) values
according to a predefined threshold (see Details).
Usage
bm_BinaryTransformation(data, threshold, do.filtering = FALSE)
## S4 method for signature 'data.frame'
bm_BinaryTransformation(data, threshold, do.filtering = FALSE)
## S4 method for signature 'matrix'
bm_BinaryTransformation(data, threshold, do.filtering = FALSE)
## S4 method for signature 'numeric'
bm_BinaryTransformation(data, threshold, do.filtering = FALSE)
## S4 method for signature 'SpatRaster'
bm_BinaryTransformation(data, threshold, do.filtering = FALSE)
Arguments
data |
a |
threshold |
a |
do.filtering |
(optional, default |
Details
If data is a vector, threshold should be a single
numeric value.
If data is a matrix, data.frame or
SpatRaster, threshold should be a
vector containing as many values as the number of columns or
layers contained in data. If only one numeric value is given,
the same threshold will be applied to all columns or layers.
If do.filtering = FALSE, binary (0 or 1) values are returned.
If do.filtering = TRUE, values will be filtered according to threshold,
meaning that :
-
data < thresholdwill return 0 -
data >= thresholdwill return the actual values ofdata(not transformed in1)
Value
An object of the same class than data and containing either
binary (0 or 1) values, or filtered values.
Author(s)
Wilfried Thuiller, Damien Georges
See Also
BIOMOD_Projection, BIOMOD_EnsembleForecasting
Other Secundary functions:
bm_CrossValidation(),
bm_FindOptimStat(),
bm_MakeFormula(),
bm_ModelingOptions(),
bm_PlotEvalBoxplot(),
bm_PlotEvalMean(),
bm_PlotRangeSize(),
bm_PlotResponseCurves(),
bm_PlotVarImpBoxplot(),
bm_PseudoAbsences(),
bm_RunModelsLoop(),
bm_SRE(),
bm_SampleBinaryVector(),
bm_SampleFactorLevels(),
bm_Tuning(),
bm_VariablesImportance()
Examples
## Generate a 0-1000 vector (normal distribution)
vec.d <- rnorm(100, 500, 100)
## From continuous to binary / filtered vector
vec.d_bin <- bm_BinaryTransformation(data = vec.d, threshold = 500)
vec.d_filt <- bm_BinaryTransformation(data = vec.d, threshold = 500, do.filtering = TRUE)
cbind(vec.d, vec.d_bin, vec.d_filt)