Learn R Programming

fxTWAPLS (version 0.1.0)

TWAPLS.predict.w: TWA-PLS predict function

Description

TWA-PLS predict function

Usage

TWAPLS.predict.w(TWAPLSoutput, fossil_taxa)

Arguments

TWAPLSoutput

The output of the TWAPLS.w training function, either with or without fx correction.

fossil_taxa

Fossil taxa abundance data to reconstruct past climates, each row represents a site to be reconstructed, each column represents a taxon.

Value

A list of the reconstruction results. Each element in the list is described below:

fit

the fitted values using each number of components.

nPLS

the total number of components extracted.

See Also

TWAPLS.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]

# Load reconstruction data
Holocene <- read.csv("/path/to/Holocene.csv")
taxaColMin <- which(colnames(Holocene) == "taxa0")
taxaColMax <- which(colnames(Holocene) == "taxaN")
core <- Holocene[, taxaColMin:taxaColMax]

# MTCO
## Train
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)
    
## Predict
fossil_t_Tmin <- fxTWAPLS::TWAPLS.predict.w(fit_t_Tmin, core)
fossil_tf_Tmin <- fxTWAPLS::TWAPLS.predict.w(fit_tf_Tmin, core)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab