This function fits Maxent-like models using the glmnet package, designed
for presence-background data.
Usage
glmnet_mx(p, data, f, regmult = 1.0, regfun = maxnet.default.regularization,
addsamplestobackground = TRUE, weights = NULL, only_fit = FALSE,
precomp = NULL, ...)Arguments
- p
A vector of binary presence-background labels, where 1 indicates presence and 0 indicates background.
- data
A
data.framecontaining the predictor variables for the model. This must include the same number of rows as the length ofp.- f
A formula specifying the model to be fitted, in the format used by
model.matrix.- regmult
(numeric) Regularization multiplier, default is 1.0.
- regfun
A function that calculates regularization penalties. Default is
maxnet.default.regularization.- addsamplestobackground
(logical) Whether to add presence points not in the background to the background data. Default is
TRUE.- weights
(numeric) A numeric vector of weights for each observation. Default is
NULL, which sets weights to 1 for presence points and 100 for background points.- only_fit
(logical) Whether to skip computing auxiliary metadata (
entropy,featuremins,featuremaxs,varmin,varmax,samplemeans,levels) that are not required during cross-validation fold evaluation. Default isFALSE.- precomp
(list) Optional precomputed design list returned by
prep_design(), avoiding redundantmodel.matrix()and regularization calculations across multiple regularization multipliers. Default isNULL.- ...
Additional arguments to pass to
glmnet.