biomod2 (version 3.3-7.1)

makeFormula: Standardized formula maker

Description

makeFormula is an internal biomod2 function that can be useful to help users to build easily some standardized formula used later by statistical models.

Usage

makeFormula(respName, 
            explVar, 
            type = 'simple', 
            interaction.level = 0,
            ...)

Arguments

respName

a character indicating the response variable name

explVar

a matrix or a data.frame, the explanatory variables table that will be considered at modelling step

type

either 'simple', 'quadratic', 'polynomial' or 's_smoother' defining the type of formula you want to build

interaction.level

an integer, the interaction level depth between explanatory variables

...

some additional arguments (see details)

Value

A link[stats]{formula} class object that can be directly given to most of R statistical models.

Details

It's advise to give only a subset of explVar table to avoid useless memory consuming. If some explanatory variables are factorial ones, you have to give a data.frame for explVar where associated columns are define as factor.

... argument availables values are :

  • k the smooting parameter value (used only if type = 's_smoother') corespunding to k parameter of mgcv s or df gam s arguments.

See Also

BIOMOD_ModelingOptions, link[stats]{formula}

Examples

Run this code
# NOT RUN {
# create simulated data
myResp <- sample(c(0,1),20, replace=TRUE)
myExpl <- matrix(runif(60), ncol=3, dimnames=list(NULL,c('var1','var2','var3')))

# create a formula
myFormula <- makeFormula( respName = 'myResp', 
                          explVar = head(myExpl), 
                          type = 'quadratic', 
                          interaction.level = 0)
# show formula created
myFormula

# }

Run the code above in your browser using DataCamp Workspace