This internal biomod2 function allows the user to create easily a standardized formula that can be used later by statistical models.

bm_MakeFormula(
  resp.name,
  expl.var,
  type = "simple",
  interaction.level = 0,
  k = NULL
)

Arguments

resp.name

a character corresponding to the response variable name

expl.var

a matrix or data.frame containing the explanatory variables that will be used at the modeling step

type

a character corresponding to the wanted type of formula, must be simple, quadratic, polynomial or s_smoother

interaction.level

an integer corresponding to the interaction level depth between explanatory variables

k

(optional, default NULL)
An integer corresponding to the smoothing parameter value of s or s arguments (used only if type = 's_smoother')

Value

A formula class object that can be directly given to most of R statistical models.

Details

It is advised to give only a subset of expl.var table to avoid useless memory consuming.
If some explanatory variables are factorial, expl.var must be a data.frame whose corresponding columns are defined as factor.

Author

Damien Georges

Examples


## Create simple simulated data
myResp.s <- sample(c(0, 1), 20, replace = TRUE)
myExpl.s <- data.frame(var1 = sample(c(0, 1), 100, replace = TRUE),
                       var2 = rnorm(100),
                       var3 = 1:100)

## Generate automatic formula
bm_MakeFormula(resp.name = 'myResp.s',
               expl.var = head(myExpl.s),
               type = 'quadratic',
               interaction.level = 0)