Learn R Programming

fxTWAPLS (version 0.1.0)

TWAPLS.w: TWA-PLS training function

Description

TWA-PLS training function, which can perform fx correction. 1/fx^2 correction will be applied at step 7.

Usage

TWAPLS.w(
  modern_taxa,
  modern_climate,
  nPLS = 5,
  usefx = FALSE,
  fx_method = "bin",
  bin = NA
)

Arguments

modern_taxa

The modern taxa abundance data, each row represents a sampling site, each column represents a taxon.

modern_climate

The modern climate value at each sampling site.

nPLS

The number of components to be extracted.

usefx

Boolean flag on whether or not use fx correction.

fx_method

Binned or p-spline smoothed fx correction: if usefx = FALSE, this should be NA; otherwise, fx function will be used when choosing "bin"; fx_pspline function will be used when choosing "pspline".

bin

Binwidth to get fx, needed for both binned and p-splined method. if usefx = FALSE, this should be NA;

Value

A list of the training results, which will be used by the predict function. Each element in the list is described below:

fit

the fitted values using each number of components.

x

the observed modern climate values.

taxon_name

the name of each taxon.

optimum

the updated taxon optimum

comp

each component extracted (will be used in step 7 regression).

u

taxon optimum for each component (step 2).

t

taxon tolerance for each component (step 2).

z

a parameter used in standardization for each component (step 5).

s

a parameter used in standardization for each component (step 5).

orth

a list that stores orthogonalization parameters (step 4).

alpha

a list that stores regression coefficients (step 7).

meanx

mean value of the observed modern climate values.

nPLS

the total number of components extracted.

See Also

fx, TWAPLS.predict.w, and WAPLS.w

Examples

Run this code
# 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]

# MTCO
fit_t_Tmin <- fxTWAPLS::TWAPLS.w(taxa, modern_pollen$Tmin, nPLS = 5)
fit_tf_Tmin <- fxTWAPLS::TWAPLS.w(taxa, 
                                  modern_pollen$Tmin, 
                                  nPLS = 5, 
                                  usefx = TRUE, 
                                  fx_method = "bin",
                                  bin = 0.02)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab