predictEnmSdm: Generic predict function for LMs, GLMs, GAMs, RFs, BRTs,...

View source: R/predictEnmSdm.r

predictEnmSdmR Documentation

Generic predict function for LMs, GLMs, GAMs, RFs, BRTs, CRFs, Maxent, and more

Description

This is a generic predict function that automatically uses the model common arguments for predicting models of the following types: linear models, generalized linear models (GLMs), generalized additive models (GAMs), random forests, boosted regression trees (BRTs)/gradient boosting machines (GBMs), conditional random forests, Maxent, and more.

Usage

predictEnmSdm(
  model,
  newdata,
  maxentFun = "dismo",
  cores = 1,
  nrows = nrow(newdata),
  ...
)

Arguments

model

Object of class lm, glm, gam, randomForest, MaxEnt, MaxNet, prcomp, kde, gbm, and possibly others (worth a try!).

newdata

Data frame or matrix with data to which to predict

maxentFun

This argument is only used if the model object is a MaxEnt model; otherwise, it is ignored. I takes a value of either 'dismo', in which case a MaxEnt model is predicted using the default predict function from the dismo package, or 'enmSdm' in which case the function predictMaxEnt function from the enmSdm package (this package) is used.

cores

Number of cores to use. The default is 1. If >1 and newdata is a raster, only 1 core is used (i.e., basically, cores is ignored if you're writing to a raster... sorry!)

nrows

Number of rows of newdata to predict at a time (assuming newdata is a data.frame or matrix). The default value is to predict all rows at once, but for very large data frames/matrices this can lead to memory issues in some cases. By setting the number of rows, newdata can be divided into chunks, and predictions made to each chunk, which may ease memory limitations. This can be combined with multi-coring (which will increase memory requirements). In this case, all cores combined will get nrows of data. How many rows are too many? You will have to decide depending on your data and the output. For example, predicting the outcome of a GLM on data with 10E6 rows ma be fine, but predicting a PCA (with multiple axes) to the data data may require too much memory. You can use memUse to see to help figure this out.

...

Arguments to pass to the algorithm-specific predict function.

Value

Numeric.

See Also

predict from the stats package, predict from the dismo package, predict from the raster package, predict from the terra package


adamlilith/enmSdm documentation built on Jan. 6, 2023, 11 a.m.