# NOT RUN {
# Load modern pollen data
modern_pollen <- read.csv("/path/to/modern_pollen.csv")
# Extract taxa
taxaColMin <- which(colnames(modern_pollen) == "taxa0")
taxaColMax <- which(colnames(modern_pollen) == "taxaN")
taxa <- modern_pollen[, taxaColMin:taxaColMax]
# Load reconstruction data
Holocene <- read.csv("/path/to/Holocene.csv")
taxaColMin <- which(colnames(Holocene) == "taxa0")
taxaColMax <- which(colnames(Holocene) == "taxaN")
core <- Holocene[, taxaColMin:taxaColMax]
## SSE
nboot <- 5 # Recommended 1000
### without fx
sse_t_Tmin_WAPLS <- fxTWAPLS::sse.sample(modern_taxa = taxa,
modern_climate = modern_pollen$Tmin,
fossil_taxa = core,
trainfun = fxTWAPLS::TWAPLS.w,
predictfun =
fxTWAPLS::TWAPLS.predict.w,
nboot = nboot,
nPLS = 5,
nsig = 3,
usefx = FALSE,
cpus = 2,
seed = 1)
### with fx
sse_tf_Tmin_WAPLS <- fxTWAPLS::sse.sample(modern_taxa = taxa,
modern_climate =
modern_pollen$Tmin,
fossil_taxa = core,
trainfun = fxTWAPLS::TWAPLS.w,
predictfun =
fxTWAPLS::TWAPLS.predict.w,
nboot = nboot,
nPLS = 5,
nsig = 3,
usefx = TRUE,
fx_method = "bin",
bin = 0.02,
cpus = 2,
seed = 1)
# Run with progress bar
`%>%` <- magrittr::`%>%`
### without fx
sse_t_Tmin_WAPLS <- fxTWAPLS::sse.sample(modern_taxa = taxa,
modern_climate = modern_pollen$Tmin,
fossil_taxa = core,
trainfun = fxTWAPLS::TWAPLS.w,
predictfun =
fxTWAPLS::TWAPLS.predict.w,
nboot = nboot,
nPLS = 5,
nsig = 3,
usefx = FALSE,
cpus = 2,
seed = 1) %>% fxTWAPLS::pb()
### with fx
sse_tf_Tmin_WAPLS <- fxTWAPLS::sse.sample(modern_taxa = taxa,
modern_climate =
modern_pollen$Tmin,
fossil_taxa = core,
trainfun = fxTWAPLS::TWAPLS.w,
predictfun =
fxTWAPLS::TWAPLS.predict.w,
nboot = nboot,
nPLS = 5,
nsig = 3,
usefx = TRUE,
fx_method = "bin",
bin = 0.02,
cpus = 2,
seed = 1) %>% fxTWAPLS::pb()
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab