The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
The goal of this package is to provide an improved version of WA-PLS by including the tolerances of taxa and the frequency of the sampled climate variable. This package also provides a way of leave-out cross-validation that removes both the test site and sites that are both geographically close and climatically close for each cycle, to avoid the risk of pseudo-replication.
You can install the released version of fxTWAPLS from CRAN with:
install.packages("fxTWAPLS")
And the development version from GitHub with:
install.packages("remotes")
::install_github("special-uor/fxTWAPLS", "dev") remotes
Latest: Liu, M., Shen, Y.,
González-Sampériz, P., Gil-Romera, G., ter Braak, C. J. F., Prentice, I.
C., and Harrison, S. P.: Holocene climates of the Iberian Peninsula:
pollen-based reconstructions of changes in the west-east gradient of
temperature and moisture, Clim. Past Discuss. [preprint], https://doi.org/10.5194/cp-2021-174, in review, 2021.-
fxTWAPLS v0.1.0
install.packages("remotes")
::install_github("special-uor/fxTWAPLS@v0.1.0") remotes
Liu Mengmeng, Prentice Iain Colin, ter Braak Cajo J. F., Harrison
Sandy P.. 2020 An improved statistical approach for reconstructing past
climates from biotic assemblages. Proc. R. Soc. A.
476: 20200346. https://doi.org/10.1098/rspa.2020.0346 - fxTWAPLS v0.0.2
install.packages("remotes")
::install_github("special-uor/fxTWAPLS@v0.0.2") remotes
The following functions can be executed in parallel:
To do so, include the cpus
parameter. For example:
<- fxTWAPLS::cv.pr.w(
cv_pr_tf_Tmin2
taxa,$Tmin,
modern_pollennPLS = 5,
::TWAPLS.w2,
fxTWAPLS::TWAPLS.predict.w,
fxTWAPLS
pseudo_Tmin,usefx = TRUE,
fx_method = "pspline",
bin = 0.02,
cpus = 2
)
Optionally, a progress bar can be displayed for long computations.
Just “pipe” the function call to fxTWAPLS::pb()
.
`%>%` <- magrittr::`%>%`
<- fxTWAPLS::cv.pr.w(
cv_pr_tf_Tmin2
taxa,$Tmin,
modern_pollennPLS = 5,
::TWAPLS.w2,
fxTWAPLS::TWAPLS.predict.w,
fxTWAPLS
pseudo_Tmin,usefx = TRUE,
fx_method = "pspline",
bin = 0.02,
cpus = 2
%>%
) ::pb() fxTWAPLS
Alternatively, if you are not familiar with the “pipe” operator, you can run the following code:
<- fxTWAPLS::pb(
cv_pr_tf_Tmin2 ::cv.pr.w(
fxTWAPLS
taxa,$Tmin,
modern_pollennPLS = 5,
::TWAPLS.w2,
fxTWAPLS::TWAPLS.predict.w,
fxTWAPLS
pseudo_Tmin,usefx = TRUE,
fx_method = "pspline",
bin = 0.02,
cpus = 2
) )
# Load modern data
<- read.csv("/path/to/modern_pollen.csv")
modern_pollen
# Extract modern pollen taxa
<- which(colnames(modern_pollen) == "taxa0")
taxaColMin <- which(colnames(modern_pollen) == "taxaN")
taxaColMax <- modern_pollen[, taxaColMin:taxaColMax]
taxa
# Set the binwidth to get the sampling frequency of the climate (fx),
# the fit is almost insenitive to binwidth when choosing pspline method.
<- 0.02
bin
# Use fxTWAPLSv2 to train
<- fxTWAPLS::TWAPLS.w2(
fit_tf_Tmin2
taxa,$Tmin,
modern_pollennPLS = 5,
usefx = TRUE,
fx_method = "pspline",
bin = bin
)
# Set CPUS to run in parallel
<- 6
CPUS
# Import pipe operator to use with the progress bar
`%>%` <- magrittr::`%>%`
# Get the location information of each sample
<- modern_pollen[, c("Long", "Lat")]
point
# Get the distance between each point
<- fxTWAPLS::get_distance(point, cpus = CPUS)
dist
# Get the pseudo sites (which are both geographically close and climatically
# close to the test site) which should be removed in cross validation
<- fxTWAPLS::get_pseudo(
pseudo_Tmin
dist,$Tmin,
modern_pollencpus = CPUS
)
# Leave-out cross validation
<- fxTWAPLS::cv.pr.w(
cv_pr_tf_Tmin2
taxa,$Tmin,
modern_pollennPLS = 5,
::TWAPLS.w2,
fxTWAPLS::TWAPLS.predict.w,
fxTWAPLS
pseudo_Tmin,usefx = TRUE,
fx_method = "pspline",
bin = bin,
cpus = CPUS,
test_mode = FALSE
%>%
) ::pb()
fxTWAPLS
# Random t test to the cross validation result
<-
rand_pr_tf_Tmin2 ::rand.t.test.w(cv_pr_tf_Tmin2, n.perm = 999) fxTWAPLS
# Load fossil data
<- read.csv("/path/to/Holocene.csv")
Holocene
# Extract fossil pollen taxa
<- which(colnames(Holocene) == "taxa0")
taxaColMin <- which(colnames(Holocene) == "taxaN")
taxaColMax <- Holocene[, taxaColMin:taxaColMax]
core
# Choose nsig (the last significant number of components) based on the p-value
<- 3
nsig
# Predict
<- fxTWAPLS::TWAPLS.predict.w(fit_tf_Tmin2, core)
fossil_tf_Tmin2
# Get the sample specific errors
<- fxTWAPLS::sse.sample(
sse_tf_Tmin2 modern_taxa = taxa,
modern_climate = modern_pollen$Tmin,
fossil_taxa = core,
trainfun = fxTWAPLS::TWAPLS.w2,
predictfun = fxTWAPLS::TWAPLS.predict.w,
nboot = nboot,
nPLS = 5,
nsig = nsig,
usefx = TRUE,
fx_method = "pspline",
bin = bin,
cpus = CPUS
%>%
) ::pb()
fxTWAPLS# Output
<-
recon_result cbind.data.frame(
recon_Tmin = fossil_tf_Tmin2[["fit"]][, nsig],
sse_recon_Tmin = sse_tf_Tmin2
)
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.