plot_pls_indepPred: Independent plsr prediction

View source: R/calc_plsr.r

plot_pls_indepPredR Documentation

Independent plsr prediction

Description

Use independent data for predictions in the pls-models within the cube and plot those predictions and, if available, the validation data.

Usage

plot_pls_indepPred(
  indepDataset,
  cube,
  cnv = NULL,
  inv = NULL,
  psd = "def",
  aps = "def",
  pl = TRUE,
  toxls = "def",
  ...
)

Arguments

indepDataset

The dataset containing the independent data. An object of class 'aquap_data' as produced by gfd.

cube

An object of class 'aquap_cube' as produced by gdmm. It is an error to have no plsr models in the cube.

cnv

"Cube numeric variable", character vector or NULL. The names of one or more numeric variables in the cube on which models have been calculated. Leave at the default NULL to use all of the numeric variables on which a plsr model has been calculated, or provide a character vector with valid variable names for a sub-selection. For the selected variables, predictions from the data in the independent dataset will be made. If argument inv is left at its default NULL, numerical variables with exactly the same name are looked for in the independent dataset and, if present, are used for validating the predictions.

inv

"Independent numeric variable", character vector or NULL. The names of numeric variables in the independent dataset. If left at the default NULL, numerical variables in the independent dataset with exactly the same name(s) as specified in argument cnv are looked for and, if present, are used for validating the predictions. If a character vector is provided, it has to have the same length as the one in cnv, and those variables will be used, in the given sequence, for validating the predictions.

psd

'plot secondary data'; either character 'def' or logical. If secondary (i.e.crossvalidation data) should be plotted as well. Leave at the default 'def' to take the value from the parameter plsr_plot_secondaryData in the settings file, or provide TRUE or FALSE. The alpha level for the secondary data can be set in parameter plsr_color_alpha_secondaryData in the settings file.

aps

Character length one. The default way to obtain the analysis procedure. Defaults to "def". Possible values are:

"def"

The default from the settings.r file is taken. (Argument gen_plot_anprocSource)

"cube"

Take the analysis procedure from within the cube, i.e. the analysis procedure that was used when creating the cube via gdmm is used.

"defFile"

Use the analysis procedure with the default filename as specified in the settings.r file in fn_anProcDefFile.

Custom filename

Provide any valid filename for an analysis procedure to use as input for specifying the plotting options.

pl

Logical, defaults to TRUE. If predicted data should be plotted at all. If FALSE, only the calculation and the (possible) export to an excel file (see details) will be performed.

toxls

'def' or logical. If left at the default 'def' the value from plsr_indepPred_exportToExcel in the settings file is used. Set to TRUE or FALSE to directly control if export of predicted data to excel should be performed or not.

...

Arguments for overriding one or more of the plotting parameters from the analysis procedure, please see plot_pls_args.

Details

Please see the documentation for the single parameters (cnv and inv) to see how the selection of the available models and the selection of possibly available data for validation is handled. For coloring, the argument pls.colorBy of the analysis procedure can be used, but here the data for the colors are selected from the independent dataset. If the parameter plsr_indepPred_exportToExcel in the settings file is set to TRUE, the results are exported to an excel file in the results folder as well.

Value

An (invisible) list containing the numerical results of the predictions, and if parameter plsr_indepPred_exportToExcel in the settings file is set to TRUE, these data are exported to an excel file in the results folder as well.

See Also

Other PLSR documentation: calc_pls_args, plot_pls,aquap_cube-method, plot_pls_args

Other Plot functions: plot,aquap_cube,missing-method, plot,aquap_data,missing-method, plot_aqg(), plot_classifX_indepPred(), plot_da,aquap_cube-method, plot_nnet,aquap_cube-method, plot_pca,aquap_cube-method, plot_pls,aquap_cube-method, plot_rnf,aquap_cube-method, plot_simca,aquap_cube-method, plot_svm,aquap_cube-method

Examples

## Not run: 
fd <- gfd()
cu <- gdmm(fd) # assumes that you have plsr enabled in the analysis procedure
fdIndep <- fd # !!!pretend!!! that fdIndep is now an other, independent dataset
predList <- plot_pls_indepPred(fdIndep, cu)
predList <- plot_pls_indepPred(fdIndep, cu, cnv="Y_Temp") # to only use the 
# models regressed on 'Y_Temp'
predList <- plot_pls_indepPred(fdIndep, cu, cnv="Y_Temp", inv="Y_fooBar")
# to only use the models regressed on 'Y_Temp', and use the numeric variable 
# 'Y_fooBar' from the independent dataset for validation
predList <- plot_pls_indepPred(fdIndep, cu, aps="fooBar.r") # use the values 
from the analysis procedure file 'fooBar.r' for plotting
predList <- plot_pls_indepPred(fdIndep, cu, pl=FALSE) # no plotting, just 
# calculation and possible export to excel.
predList <- plot_pls_indepPred(fdIndep, cu, pls.colorBy="C_Group") # use the 
# class variable 'C_Group' from the independent dataset for coloring
predList <- plot_pls_indepPred(fdIndep, cu, pg.where="pdf", pg.fns="_fooBar") 
# add the string '_fooBar' to the generated pdfs.
predList <- plot_pls_indepPred(fdIndep, cu, toxls=FALSE) # no exporting to xls

## End(Not run)

bpollner/aquap2 documentation built on June 29, 2024, 5:21 p.m.