treedacv: treeda cross validation

Description Usage Arguments Value Examples

View source: R/treeda-functions.R

Description

Performs cross-validation of a treeda fit.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
treedacv(
  response,
  predictors,
  tree,
  folds = 5,
  pvec = 1:tree$Nnode,
  k = nclasses - 1,
  center = TRUE,
  scale = TRUE,
  class.names = NULL,
  ...
)

Arguments

response

The classes to be predicted.

predictors

A matrix of predictors corresponding to the tips of the tree.

tree

A tree object of class phylo.

folds

Either a single number corresponding to the number of folds of cross-validation to perform or a vector of integers ranging from 1 to the number of folds desired giving the partition of the dataset.

pvec

The values of p to use.

k

The number of discriminating axes to keep.

center

Center the predictors?

scale

Scale the predictors?

class.names

A vector giving the names of the classes.

...

Additional arguments to be passed to treeda.

Value

A list with the value of p with minimum cv error (p.min), the minimum value of p with in 1 se of the minimum cv error (p.1se), and a data frame containing the loss for each fold, mean loss, and standard error of the loss for each value of p (loss.df).

Examples

1
2
3
4
5
6
data(treeda_example)
out.treedacv = treedacv(response = treeda_example$response,
    predictors = treeda_example$predictors,
    tree = treeda_example$tree,
    pvec = 1:10)
out.treedacv

jfukuyama/treeDA documentation built on May 18, 2021, 8:52 a.m.