View source: R/s2bak_predict.R
predict.s2bak | R Documentation |
s2bak
is provided, the user can specify
what type of model predictions to use to allow for specific outputs from
the sub-components of the model. When applying predict.s2bak
,
the function assumes that predict.fun
is the same for all models.The function predict.s2bak.s2 is used for s2bak.so
and
s2bak.s2
models. It automatically detects which
model class is provided and makes the appropriate adjustments.
predict.s2bak.so is a wrapper function
that detects the class of the inputed model and makes the appropriate
prediction.
For s2bak.s2
models, the binary variable denoting sightings-only or survey
is stored and will be checked by the function.
predict.s2bak.bak adjusts sightings-only predictions using a fitted s2bak.bak model, using trait, environmental data and sightings-only (predict.s2bak.so) predictions.
## S3 method for class 's2bak' predict( model, newdata, trait = NA, predict.fun, predict.bak.fun, output = c("s2bak", "all", "so", "s2", "sobak")[1], ncores = 1, useReadout = FALSE, ... ) ## S3 method for class 's2bak.s2' predict(model, newdata, predict.fun, useReadout = FALSE, ncores = 1, ...) ## S3 method for class 's2bak.so' predict(model, newdata, predict.fun, useReadout = FALSE, ncores = 1, ...) ## S3 method for class 's2bak.bak' predict( model, predictions, trait, data, predict.bak.fun, truncate = c(1e-04, 0.9999) )
model |
Output from fit.s2bak.bak(), with fitted BaK model |
newdata |
A data.frame containing the values . All variables needed for prediction should be included. |
trait |
Trait data, with column 'species' matching those in predictions. |
predict.fun |
Predict function linked to the SDM used. Functions have the structure of model and newdata as the first and second arguments, respectively. |
predict.bak.fun |
Model function for predicting bias adjustment model
(e.g., predict.glm). Needs to match |
output |
The choice of how predictions are made using the Only one type of output can be selected: sightings-only (output = "so"), sightings-survey (S2; output = "s2") and bias-adjusted sightings-only (output = "sobak"). If interested in using the The default method is #' If the |
ncores |
Number of cores to fit the SDMs, default is 1 core but can be automatically set if ncores=NA. If ncores > number of available cores - 1, set to the latter. |
useReadout |
logical; if TRUE will do readout over stored SDMs. If there are no SDMs then it will automatically check for readout |
... |
Additional arguments passed into function for prediction (predict.fun). |
predictions |
Sightings-only predictions as a matrix or data.frame with rows as sites and columns as species. Assumes as type="response", and rows of data.frame correspond to newdata rows. |
data |
Environmental data, with rows corresponding to rows of predictions |
truncate |
Numeric minimum and maximum range of predicted values. Values very close to zero or one cannot be meaningfully distinguished, however these extreme values may have disproportionally large consequences on likelihoods due to logit transformation. |
survey_var |
Character name for the predictor variable determining a site is sightings-only (1) or survey data (0). The column is automatically within the function, and is used to define with formula. |
Model predictions as a data.frame with columns for each species and rows for each location. If output = "all" is selected, a lot of data.frame predictions are returned.
Generates a matrix of predictions with rows being indices in the data.frame, and columns representing each species.
Model predictions but with adjustments made by the BaK model. Note the default right now is type="response"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.