# blocked cv using ::blockCV #library(blockCV) #library(raster) #library(gstat) mat1 <- as.matrix(cbind(map_dat$LONG,map_dat$LAT,pred_dat$t_v)) mycrs <- "+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs" rast1 <- raster::raster(mat1, crs = mycrs) spatialAutoRange(rasterLayer = rast1,showPlots = T) #crs(rast1) <- "+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs" library(sp) # spatialBlock(speciesData = FirstPoints) sac <- spatialAutoRange(rasterLayer = rast1, sampleNumber = 5000, doParallel = TRUE, showPlots = TRUE) FirstPoints <- SpatialPoints(coords = cbind(map_dat$LAT,map_dat$LONG,pred_dat$t_v)) sb <- spatialBlock(speciesData = FirstPoints, theRange = 341126, # size of the blocks in meters k = 5, # number of folds selection = "random", iteration = 100, # find evenly dispersed folds biomod2Format = TRUE) # redoing it because unequal nr of 0s and 1s in sb # eb <- envBlock(speciesData = FirstPoints, # k = 5, # standardization = "standard", # rescale variables between 0 and 1 # numLimit = 50) # these are our blocked folds length(sb$foldID) sb$plots