This engine implements a basic generalized linear modle (GLM) for creating species distribution models. The main purpose of this engine is to support a basic, dependency-free method for inference and projection that can be used within the package for examples and vignettes. That being said, the engine is fully functional as any other engine.
The basic implementation of GLMs here is part of a general class oflinear models
and has - with exception of offsets - only minimal options to integrate other
sources of information such as priors or joint integration. The general
recommendation is to engine_glmnet()
instead for regularization support.
However basic GLMs can in some cases be useful for quick projections or
for ensemble()
of small models (a practice common for rare species).
Arguments
- x
distribution()
(i.e.BiodiversityDistribution
) object.- control
A
list
containing parameters for controlling the fitting process (Default:NULL
).- type
The mode used for creating posterior predictions. Either making
"link"
or"response"
(Default:"response"
).- ...
Other parameters passed on to
stats::glm()
.
Value
An Engine.
Details
This engine is essentially a wrapper for stats::glm.fit()
, however with customized
settings to support offsets and weights.
If "optim_hyperparam"
is set to TRUE
in train()
, then a AIC
based step-wise (backwards) model selection is performed.
Generally however engine_glmnet
should be the preferred package for models
with more than >3
covariates.
References
Hastie, T. J. and Pregibon, D. (1992) Generalized linear models. Chapter 6 of Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole.
See also
Other engine:
engine_bart()
,
engine_breg()
,
engine_gdb()
,
engine_glmnet()
,
engine_inla()
,
engine_inlabru()
,
engine_scampr()
,
engine_stan()
,
engine_xgboost()
Examples
# Load background
background <- terra::rast(system.file('extdata/europegrid_50km.tif',
package='ibis.iSDM',mustWork = TRUE))
# Add GLM as an engine
x <- distribution(background) |> engine_glm()
#> [Setup] 2024-12-13 23:29:12.877416 | Creating distribution object...
print(x)
#> <Biodiversity distribution model>
#> Background extent:
#> xmin: -16.064, xmax: 36.322,
#> ymin: 34.95, ymax: 71.535
#> projection: +proj=longlat +datum=WGS84 +no_defs
#> ---------
#> Biodiversity data:
#> None
#> ---------
#> predictors: None
#> priors: <Default>
#> latent: None
#> log: <Console>
#> engine: <GLM>