Skip to contents

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

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


Method new()

Initializes the object and creates an empty list

Usage

Arguments

name

A description of the model as character.

Returns

NULL


Method get_name()

Return the name of the model

Usage

DistributionModel$get_name()

Returns

A character with the model name used.


Method print()

Print the names and summarizes the model within

Usage

DistributionModel$print()

Returns

A message on screen


Method show()

Show the name of the Model.

Usage

DistributionModel$show()

Returns

A character of the run name.


Method 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


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


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


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


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


Method get_equation()

Get equation

Usage

DistributionModel$get_equation()

Returns

A formula of the inferred model.


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


Method get_model()

Small internal helper function to directly get the model object

Usage

DistributionModel$get_model()

Returns

A fitted model if existing.


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


Method get_thresholdvalue()

Get the threshold value if calculated

Usage

DistributionModel$get_thresholdvalue()

Returns

A numeric threshold value.


Method get_thresholdtype()

Get threshold type and format if calculated.

Usage

DistributionModel$get_thresholdtype()

Returns

A vector with a character method and numeric threshold value.


Method show_rasters()

List all rasters in object

Usage

DistributionModel$show_rasters()

Returns

A vector with logical flags for the various objects.


Method get_projection()

Get projection of the background.

Usage

DistributionModel$get_projection()

Returns

A geographic projection


Method get_resolution()

Get the resolution of the projection

Usage

DistributionModel$get_resolution()

Returns

numeric estimates of the distribution.


Method rm_threshold()

Remove calculated thresholds

Usage

DistributionModel$rm_threshold()

Returns

Invisible


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


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


Method has_limits()

Logical indication if the prediction was limited.

Usage

DistributionModel$has_limits()

Returns

A logical flag.


Method has_latent()

Logical indication if the prediction has added latent factors.

Usage

DistributionModel$has_latent()

Returns

A logical flag.


Method has_offset()

Has a offset been used?

Usage

DistributionModel$has_offset()

Returns

A logical flag.


Method 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


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


Method clone()

The objects of this class are cloneable with this method.

Usage

DistributionModel$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.