permutation_spls: Perform permutation test

permutation_splsR Documentation

Perform permutation test

Description

Performs a permutation test of an spls fit or a train object. Uses hyperparameters from the fit (or optimal caret::train-fit), which may be anti-conservative (overfit to data) so beware.

Usage

permutation_spls(fit, permutations = 1000, tester = cor, ...,
  comp = "all", seed = as.integer(Sys.time()), strata = NULL,
  fitfunc = mixOmics::spls)

Arguments

fit

A model from mixOmics::spls or a train object from caret, fit using mixOmics spls.

permutations

The number of permutations to perform.

tester

A function used to compare the X and Y components, such as cor, or a character variable with one of the built-in methods ("cor", "rsq", "p", or "rmse"). Custom functions must return symmetric matrix (like cor)

...

Additional arguments to tester, such as method = "spearman".

comp

The component(s) that we wish to compute p values for as a numeric vector (e.g. 2:4), or "all" (default: "all").

seed

Random seed.

strata

Value to constrain permutations.

fitfunc

The function used to compute the permuted fits, currently only works with mixOmics::spls.

Value

A list with the elements

  • p.values - the computed p values per component

  • true - the true values (from tester) that will be compared to a null distribution

  • track - the permutation-distribution of values (from tester) that the true value was compared against.

  • seed - the random seed used, for reproducibility.

Examples

library(caret)
x <- data.frame(matrix(rnorm(1000),nrow = 100))
y <- rnorm(100)
PLS <- train(x = x, y = y, method = get_mixOmics_spls())
perms <- permutation_spls(PLS)

jonathanth/mixOmicsCaret documentation built on Feb. 25, 2023, 5:41 a.m.