bm_SampleBinaryVector: Sample binary vector

View source: R/bm_SampleBinaryVector.R

bm_SampleBinaryVectorR Documentation

Sample binary vector

Description

This internal biomod2 function allows the user to sample a binary vector keeping the same proportion of 0 and 1 as the initial vector.

Usage

bm_SampleBinaryVector(obs, ratio, as.logical = FALSE, seedval = NULL)

Arguments

obs

a vector containing binary values (either 0 or 1)

ratio

a numeric between 0 and 1 corresponding to the proportion of obs values to sample

as.logical

(optional, default FALSE)
A logical value defining whether a vector of TRUE/FALSE values should be returned (if as.logical = TRUE) or a vector containing the indices of obs elements to keep

seedval

(optional, default NULL)
An integer value corresponding to the new seed value to be set

Value

A list containing to elements is returned :

calibration

IDs of elements selected for calibration

validation

IDs of elements selected for validation (complementary to the calibration set)

Author(s)

Damien Georges

See Also

bm_CVnnet

Other Secundary functions: bm_BinaryTransformation(), bm_CVnnet(), bm_CrossValidation(), bm_FindOptimStat(), bm_MakeFormula(), bm_PlotEvalBoxplot(), bm_PlotEvalMean(), bm_PlotRangeSize(), bm_PlotResponseCurves(), bm_PlotVarImpBoxplot(), bm_PseudoAbsences(), bm_RunModelsLoop(), bm_SRE(), bm_SampleFactorLevels(), bm_VariablesImportance()

Examples


## Generate a binary vector
vec.a <- sample(c(0, 1), 100, replace = TRUE)

## Generate calibration / validation datasets
bm_SampleBinaryVector(obs = vec.a, ratio = 0.7)



biomod2 documentation built on July 9, 2023, 6:05 p.m.