Get the sites which are both geographically and climatically close to the test site, which could result in pseudo-replication and inflate the cross-validation statistics. The output will be used in cv.pr.w.

get_pseudo(dist, x, cpus = 4, test_mode = FALSE, test_it = 5)

Arguments

dist

Distance matrix which contains the distance from other sites.

x

The modern climate values.

cpus

Number of CPUs for simultaneous iterations to execute, check parallel::detectCores() for available CPUs on your machine.

test_mode

Boolean flag to execute the function with a limited number of iterations, test_it, for testing purposes only.

test_it

Number of iterations to use in the test mode.

Value

The geographically and climatically close sites to each test site.

See also

Examples

if (FALSE) {
# Load modern pollen data
modern_pollen <- read.csv("/path/to/modern_pollen.csv")

point <- modern_pollen[, c("Long", "Lat")]
test_mode <- TRUE # It should be set to FALSE before running
dist <- fxTWAPLS::get_distance(
  point,
  cpus = 2, # Remove the following line
  test_mode = test_mode
)
pseudo_Tmin <- fxTWAPLS::get_pseudo(
  dist,
  modern_pollen$Tmin,
  cpus = 2, # Remove the following line
  test_mode = test_mode
)
# Run with progress bar
`%>%` <- magrittr::`%>%`
pseudo_Tmin <- fxTWAPLS::get_pseudo(
  dist,
  modern_pollen$Tmin,
  cpus = 2, # Remove the following line
  test_mode = test_mode
) %>%
  fxTWAPLS::pb()
}