predict.sjSDM {sjSDM}R Documentation

Predict from a fitted sjSDM model

Description

Predict from a fitted sjSDM model

Usage

## S3 method for class 'sjSDM'
predict(
  object,
  newdata = NULL,
  SP = NULL,
  Y = NULL,
  type = c("link", "raw"),
  dropout = FALSE,
  ...
)

Arguments

object

a model fitted by sjSDM

newdata

newdata for predictions

SP

spatial predictors (e.g. X and Y coordinates)

Y

Known occurrences of species, must be a matrix of the original size, species to be predicted must consist of NAs

type

raw or link

dropout

use dropout for predictions or not, only supported for DNNs

...

optional arguments for compatibility with the generic function, no function implemented

Value

Matrix of predictions (sites by species)

Examples

## Not run: 

## Conditional predictions based on focal species
com = simulate_SDM(sites = 200L)
## first 100 observations are the training data
model = sjSDM(com$response[1:100, ], com$env_weights[1:100,])
## Assume that for the other 100 observations, only the first species is missing 
## and we want to use the other 4 species to improve the predictions:
Y_focal = com$response[101:200, ]
Y_focal[,1] = NA # set to NA because occurrences are unknown

pred_conditional = predict(model, newdata = com$env_weights[101:200,], Y = Y_focal)
pred_unconditional = predict(model, newdata = com$env_weights[101:200,])[,1]

## Compare performance:
Metrics::auc(com$response[101:200, 1], pred_conditional)
Metrics::auc(com$response[101:200, 1], pred_unconditional)

## Conditional predictions are better, however, it only works if occurrences of
## other species for new sites are known!


## End(Not run)

[Package sjSDM version 1.0.6 Index]