datasetOut {PointedSDMs}R Documentation

datasetOut: function that removes a dataset out of the main model, and calculates some cross-validation score.

Description

This function calculates the difference in covariate values between a full integrated model and a model with one dataset left out, as well as some cross-validation score, which is used to obtain a score of the relative importance of the dataset in the full model. The score is calculated as follows:

  1. Running a new model with one less dataset (from the main model) – resulting in a reduced model,

  2. predicting the intensity function at the locations of the left-out dataset with the reduced model,

  3. using the predicted values as an offset in a new model,

  4. finding the difference between the marginal-likelihood of the main model (ie the model with all the datasets considered) and the marginal-likelihood of the offset model.

Usage

datasetOut(model, dataset, predictions = TRUE)

Arguments

model

Model of class bru_sdm run with multiple datasets.

dataset

Names of the datasets to leave out. If missing, will run for all datasets used in the full model.

predictions

Will new models be used for predictions. If TRUE returns marginals and bru_info in model. Defaults to TRUE.

Value

A list of inlabru models with the specified dataset left out. If predictions is FALSE, these objects will be missing their bru_info and call lists.

Examples


## Not run: 
 if (requireNamespace('INLA')) {
   
 #Get Data
 data("SolitaryTinamou")
 proj <- "+proj=longlat +ellps=WGS84"
 data <- SolitaryTinamou$datasets
 mesh <- SolitaryTinamou$mesh
 mesh$crs <- proj
 
 #Set model up
 organizedData <- intModel(data, Mesh = mesh, Coordinates = c('X', 'Y'),
                             Projection = proj, responsePA = 'Present')
 
  ##Run the model
  modelRun <- fitISDM(organizedData,
              options = list(control.inla = list(int.strategy = 'eb')))
   
  #Choose dataset to leave out
  eBirdOut <- datasetOut(modelRun, dataset = 'eBird')
  
  #Print datasetOut summary
  eBirdOut
  
  
   
 }

## End(Not run)

[Package PointedSDMs version 1.3.2 Index]