Learn R Programming

fxTWAPLS (version 0.1.0)

plot_residuals: Plot the residuals

Description

Plot the residuals, the black line is 0 line, the red line is the locally estimated scatterplot smoothing, which shows the degree of local compression.

Usage

plot_residuals(train_output, col)

Arguments

train_output

Training output, can be the output of WA-PLS, WA-PLS with fx correction, TWA-PLS, or TWA-PLS with fx correction

col

Choose which column of the fitted value to plot, in other words, how many number of components you want to use.

Value

Plotting status.

See Also

TWAPLS.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
## WAPLS and fxWAPLS
fit_Tmin <- fxTWAPLS::WAPLS.w(taxa, modern_pollen$Tmin, nPLS = 5)
fit_f_Tmin <- fxTWAPLS::WAPLS.w(taxa, 
                                modern_pollen$Tmin, 
                                nPLS = 5, 
                                usefx = TRUE, 
                                fx_method = "bin",
                                bin = 0.02)
## TWAPLS and fxTWAPLS
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)
fxTWAPLS::plot_residuals(fit_Tmin, 3)
fxTWAPLS::plot_residuals(fit_f_Tmin, 3)
fxTWAPLS::plot_residuals(fit_t_Tmin, 3)
fxTWAPLS::plot_residuals(fit_tf_Tmin, 3)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab