Learn R Programming

fxTWAPLS (version 0.1.0)

rand.t.test.w: Random t-test

Description

Do a random t-test to the cross-validation results.

Usage

rand.t.test.w(cvoutput, n.perm = 999)

Arguments

cvoutput

Cross-validation output either from cv.w or cv.pr.w.

n.perm

The number of permutation times to get the p value, which assesses whether using the current number of components is significantly different from using one less.

Value

A matrix of the statistics of the cross-validation results. Each component is described below:

R2

the coefficient of determination (the larger, the better the fit).

Avg.Bias

average bias.

Max.Bias

maximum bias.

Min.Bias

minimum bias.

RMSEP

root-mean-square error of prediction (the smaller, the better the fit).

delta.RMSEP

the percent change of RMSEP using the current number of components than using one component less.

p

assesses whether using the current number of components is significantly different from using one component less, which is used to choose the last significant number of components to avoid over-fitting.

-

The degree of overall compression is assessed by doing linear regression to the cross-validation result and the observed climate values.

  • Compre.b0: the intercept.

  • Compre.b1: the slope (the closer to 1, the less the overall compression).

  • Compre.b0.se: the standard error of the intercept.

  • Compre.b1.se: the standard error of the slope.

See Also

cv.w and cv.pr.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]

## LOOCV
test_mode <- TRUE # It should be set to FALSE before running
### without fx
cv_t_Tmin <- fxTWAPLS::cv.w(taxa,
                            modern_pollen$Tmin,
                            nPLS = 5,
                            fxTWAPLS::TWAPLS.w,
                            fxTWAPLS::TWAPLS.predict.w,
                            cpus = 2, # Remove the following line
                            test_mode = test_mode) %>% fxTWAPLS::pb()
### with fx
cv_tf_Tmin <- fxTWAPLS::cv.w(taxa,
                             modern_pollen$Tmin,
                             nPLS = 5,
                             fxTWAPLS::TWAPLS.w,
                             fxTWAPLS::TWAPLS.predict.w,
                             usefx = TRUE,
                             fx_method = "bin",
                             bin = 0.02,
                             cpus = 2, # Remove the following line
                             test_mode = test_mode) %>% fxTWAPLS::pb()
                            
## Random t-test
rand_t_Tmin <- fxTWAPLS::rand.t.test.w(cv_t_Tmin, n.perm = 999)
rand_tf_Tmin <- fxTWAPLS::rand.t.test.w(cv_tf_Tmin, n.perm = 999)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab