blockedCV: run spatial blocked cross-validation on the integrated model.
blockedCV: run spatial blocked cross-validation on the integrated model.
This function is used to perform spatial blocked cross-validation with regards to model selection for the integrated model. It does so by leaving out a block of data in the full model, running a model with the remaining data, and then calculating the deviance information criteria (DIC) as a score of model fit.
data: An object produced by either startISDM of startSpecies. Requires the slot function, .$spatialBlock to be run first in order to specify how the data in the model is blocked.
options: A list of INLA or inlabru options to be used in the model. Defaults to list().
method: Which cross-validation method to perform. Must be one of 'DIC' or 'Predict'. If 'DIC' then the DIC values for each block are obtained. If 'Predict' then predictions are made on a dataset in the left out block. For this to work, please specify the argument methodOptions.
predictName: Name of the dataset to predict onto if method = 'Predict'.
datasetCombs: A list of vectors containing dataset combinations to include in each model run if method = 'Prediction'. If NULL then all combinations of the dataset will be estimated.
Returns
An object of class blockedCV, which is essentially a list of DIC values obtained from each iteration of the model.
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 <- startISDM(data, Mesh = mesh, responsePA ='Present', Projection = proj)#Set up spatial block organizedData$spatialBlock(k =2, rows =2, cols =1)#Run spatial block cross-validation blocked <- blockedCV(organizedData)#Print summary blocked
}## End(Not run)