treeda: Tree-based sparse discriminant analysis

Description Usage Arguments Value Examples

View source: R/treeda-functions.R

Description

Performs tree-structured sparse discriminant analysis using an augmented predictor matrix with additional predictors corresponding to the nodes and then translating the parameters back in terms of only the leaves.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
treeda(
  response,
  predictors,
  tree,
  p,
  k = nclasses - 1,
  center = TRUE,
  scale = TRUE,
  class.names = NULL,
  check.consist = TRUE,
  A = NULL,
  ...
)

Arguments

response

A factor or character vector giving the class to be predicted.

predictors

A matrix of predictor variables corresponding to the leaves of the tree and in the same order as the leaves of the tree.

tree

A tree of class phylo.

p

The number of predictors to use.

k

The number of components to use.

center

Center the predictor variables?

scale

Scale the predictor variables?

class.names

Optional argument giving the class names.

check.consist

Check consistency of the predictor matrix and the tree.

A

A matrix describing the tree structure. If it has been computed before it can be passed in here and will not be recomputed.

...

Additional arguments to be passed to sda

Value

An object of class treeda. Contains the coefficients in the original predictor space (leafCoefficients), the number of predictors used in the node + leaf space (nPredictors), number of leaf predictors used (nLeafPredictors), the projections of the samples onto the discriminating axes (projections), and the sparse discriminant analysis object that was used in the fit (sda).

Examples

1
2
3
4
5
6
data(treeda_example)
out.treeda = treeda(response = treeda_example$response,
    predictors = treeda_example$predictors,
    tree = treeda_example$tree,
    p = 1)
out.treeda

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