library(mgcv)
<- gam(presence ~ s(x1) + s(x2) + s(x3) + # one dimensional smooths
model s(x4, x5), # two dimensional smooths
data = __, # your data
family = ___, # your distribution (e.g. gaussian)
method = "REML" # sets parameter for your smooths
...)
Generalized Additive Models use spline functions (smooths).
The spline functions are composed of simpler basis functions witch are weighted and summed up.
\[s(x) = \sum_{k = 1}^K \beta_k b_k(x)\]
The more basis functions a smooth is made of, the more complex of a relationship the smooth can model (Simpson 2020). With the parameter k in s(x1, k = __)
you can pick the number of basis functions.