treedacv {treeDA}R Documentation

treeda cross validation

Description

Performs cross-validation of a treeda fit.

Usage

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

data(treeda_example)
out.treedacv = treedacv(response = treeda_example$response,
    predictors = treeda_example$predictors,
    tree = treeda_example$tree,
    pvec = 1:10)
out.treedacv

[Package treeDA version 0.0.5 Index]