Skip to contents

All trained Models inherit the options here plus any additional ones defined by the engine and inference.

Value

An R6::R6Class generator object.

Note

Could be further pretified and commands outsourced.

Public fields

id

A character id for any trained model

name

A description of the model as character.

model

A list containing all input datasets and parameters to the model.

settings

A Settings object with information on inference.

fits

A list containing the prediction and fitted model.

.internals

A list containing previous fitted models.

Methods


DistributionModel$new()

Initializes the object and creates an empty list

Usage

Arguments

name

A description of the model as character.

Returns

NULL


DistributionModel$get_name()

Return the name of the model

Usage

DistributionModel$get_name()

Returns

A character with the model name used.


DistributionModel$print()

Print the names and summarizes the model within

Usage

DistributionModel$print()

Returns

A message on screen


DistributionModel$show()

Show the name of the Model.

Usage

DistributionModel$show()

Returns

A character of the run name.


DistributionModel$plot()

Plots the prediction if found.

Usage

DistributionModel$plot(what = "mean")

Arguments

what

character with the specific layer to be plotted.

Returns

A graphical representation of the prediction


DistributionModel$plot_threshold()

Plots the thresholded prediction if found.

Usage

DistributionModel$plot_threshold(what = 1)

Arguments

what

character or numeric for the layer to be plotted.

Returns

A graphical representation of the thresholded prediction if found.


DistributionModel$show_duration()

Show model run time if settings exist

Usage

DistributionModel$show_duration()

Returns

A numeric estimate of the duration it took to fit the models.


DistributionModel$summary()

Get effects or importance tables from model

Usage

DistributionModel$summary(obj = "fit_best")

Arguments

obj

A character of which object to return.

Returns

A data.frame summarizing the model, usually its coefficient.


DistributionModel$effects()

Generic plotting function for effect plots

Usage

DistributionModel$effects(x = "fit_best", what = "fixed", ...)

Arguments

x

A character for the object in question.

what

A character for the type of coefficients.

...

Any other options.

Returns

A graphical representation of the coefficents.


DistributionModel$get_equation()

Get equation

Usage

DistributionModel$get_equation()

Returns

A formula of the inferred model.


DistributionModel$get_data()

Get specific fit from this Model

Usage

DistributionModel$get_data(x = "prediction")

Arguments

x

A character stating what should be returned.

Returns

A SpatRaster object with the prediction.


DistributionModel$get_model()

Small internal helper function to directly get the model object

Usage

DistributionModel$get_model()

Returns

A fitted model if existing.


DistributionModel$set_data()

Set new fit for this Model.

Usage

DistributionModel$set_data(x, value)

Arguments

x

The name of the new fit.

value

The SpatRaster layer (or model) to be inserted.

Returns

This object.


DistributionModel$get_thresholdvalue()

Get the threshold value if calculated

Usage

DistributionModel$get_thresholdvalue()

Returns

A numeric threshold value.


DistributionModel$get_thresholdtype()

Get threshold type and format if calculated.

Usage

DistributionModel$get_thresholdtype()

Returns

A vector with a character method and numeric threshold value.


DistributionModel$show_rasters()

List all rasters in object

Usage

DistributionModel$show_rasters()

Returns

A vector with logical flags for the various objects.


DistributionModel$get_projection()

Get projection of the background.

Usage

DistributionModel$get_projection()

Returns

A geographic projection


DistributionModel$get_resolution()

Get the resolution of the projection

Usage

DistributionModel$get_resolution()

Returns

numeric estimates of the distribution.


DistributionModel$rm_threshold()

Remove calculated thresholds

Usage

DistributionModel$rm_threshold()

Returns

Invisible


DistributionModel$calc_suitabilityindex()

Calculate a suitability index for a given projection

Usage

DistributionModel$calc_suitabilityindex(method = "normalize")

Arguments

method

The method used for normalization.

Details

Methods can either be normalized by the minimum and maximum. Or the relative total using the sumof values.

Returns

Returns a SpatRaster.


DistributionModel$get_centroid()

Get centroids of prediction layers

Usage

DistributionModel$get_centroid(patch = FALSE, layer = "mean")

Arguments

patch

A logical if centroid should be calculated weighted by values.

layer

character of the layer to use.

Returns

Returns a sf object.


DistributionModel$has_limits()

Logical indication if the prediction was limited.

Usage

DistributionModel$has_limits()

Returns

A logical flag.


DistributionModel$has_latent()

Logical indication if the prediction has added latent factors.

Usage

DistributionModel$has_latent()

Returns

A logical flag.


DistributionModel$has_offset()

Has a offset been used?

Usage

DistributionModel$has_offset()

Returns

A logical flag.


DistributionModel$mask()

Convenience function to mask all input datasets.

Usage

DistributionModel$mask(mask, inverse = FALSE, ...)

Arguments

mask

A SpatRaster or sf object.

inverse

A logical flag if the inverse should be masked instead.

...

Any other parameters passed on to mask

Returns

Invisible


DistributionModel$save()

Save the prediction as output.

Usage

DistributionModel$save(fname, type = "gtif", dt = "FLT4S")

Arguments

fname

An output filename as character.

type

A format as character. Matched against a list of supported formats.

dt

The datatype used, such as float64

Returns

Saved spatial prediction on drive.


DistributionModel$clone()

The objects of this class are cloneable with this method.

Usage

DistributionModel$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

model <- DistributionModel$new("Example model")
model$get_name()
#> [1] "Example model"