Learn R Programming

TPLSr (version 1.0.3)

evalTuningParam: Evaluate TPLS tuning parameters using cross validation

Description

Evaluate TPLS tuning parameters using cross validation

Usage

evalTuningParam(
  TPLScvmdl,
  type = c("pearson", "spearman", "AUC"),
  X,
  Y,
  compvec,
  threshvec,
  subfold = NULL
)

Arguments

TPLScvmdl

TPLS_cv model created from TPLS_cv

type

Cross validation performance measure type. One of 'pearson', 'spearman', or 'AUC'

X

The SAME X that was used to create the TPLScvmdl. If it's not the same, the function may not work or the results will be completely off

Y

The SAME Y that was used to create the TPLScvmdl.

compvec

Vector containing the number of components you want to assess CV performance for (e.g., c(3,4,5) will provide CV performance of 3, 4, and 5 component TPLS model at various thresholds)

threshvec

Vector containing the thresholding level betweeon 0 and 1 you want to assess CV performance for (e.g., seq(0,1,0.1) will provide CV performance of TPLS models at thresholds of 0, 0.1, 0.2, ... ,1)

subfold

Optional vector containing smaller data division within folds. For example, if the cross-validation was done at the subject level, with each testing fold being a subject, subfold can be the run number of the scan of each person. This allows for calculation of average CV metric at the run level instead of at the subject level.

Value

A evalTuningParam object that contains the following attributes.

  • type: Cross validation performance measure type, as specified in the input

  • threshval: Same as the input threshvec

  • compval: Same as the input compvec

  • perfmat: Performance measure 3D matrix: length(compvec)-by-length(threshvec)-by-numfold

  • perf_best: Best CV performance out of all combinations of compvec and threshvec

  • compval_best: Number of components that gave the best performance (i.e., perf_best)

  • threshval_best: Threshold level that gave the best performance (i.e., perf_best)

  • perf_1se : Performance of the most parsimonious model (least number of coefficients) that is within 1 standard error of perf_best.

  • compval_1se : Number of components that gave perf_1se

  • threshval_1se : Threshold level that gave perf_1se

Examples

Run this code
# NOT RUN {
# see examples under TPLS_cv as you'd need a TPLS_cv object to run this function
# }

Run the code above in your browser using DataLab