Skip to contents

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).

Usage

engine_glm(x, control = NULL, type = "response", ...)

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.

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.

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-02-29 10:17:42.939135 | Creating distribution object...