Last data update: 2014.03.03

R: Fit a Classification Tree based on Top Scoring Pairs.
tsp.treeR Documentation

Fit a Classification Tree based on Top Scoring Pairs.

Description

Fit a Classification Tree based on Top Scoring Pairs.

Usage

tsp.tree(X, response, control = tree.control(dim(X)[1], ...), method = "recursive.partition", split = c("deviance", "gini"), x = FALSE, y = TRUE, wts = TRUE, ...)

Arguments

X

input matrix, of dimension nobs x nvars, each row is an observation vector.

response

response variable.

control

A list as returned by tree.control.

method

character string giving the method to use. The only other useful value is "model.frame".

split

Splitting criterion to use.

x

logical. If true, the matrix of variables for each case is returned.

y

logical. If true, the response variable is returned.

wts

logical. If true, the weights are returned.

...

Additional arguments

Value

frame

A data frame with a row for each node, and row.names giving the node numbers. The columns include var, the variable used at the split (or "<leaf>" for a terminal node), n, the (weighted) number of cases reaching that node, dev the deviance of the node, yval, the fitted value at the node (the mean for regression trees, a majority class for classification trees) and split, a two-column matrix of the labels for the left and right splits at the node. Classification trees also have yprob, a matrix of fitted probabilities for each response level.

where

An integer vector giving the row number of the frame detailing the node to which each case is assigned.

terms

The terms of the formula.

call

The matched call to Tree.

model

If model = TRUE, the model frame.

x

If x = TRUE, the model matrix.

y

If y = TRUE, the response.

wts

If wts = TRUE, the weights.

Author(s)

Xiaolin Yang, Han Liu

References

Czajkowski,M., Kretowski, M. (2011) Top scoring pair decision tree for gene expression data analysis. Advances in experimental medicine and biology

Breiman L., Friedman J. H., Olshen R. A., and Stone, C. J. (1984) Classification and Regression Trees. Wadsworth.

Ripley, B. D. (1996) Pattern Recognition and Neural Networks. Cambridge University Press, Cambridge. Chapter 7.

See Also

predict.tsp.tree

Examples

library(tree)
x=matrix(rnorm(100*20),100,20)
y=rbinom(100,1,0.5)
y=as.factor(y)
data=data.frame(y,x)
tr=tsp.tree(x,y)
predict(tr,data[1:10,])
plot(tr)
text(tr)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BigTSP)
Loading required package: glmnet
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-5

Loading required package: tree
Loading required package: randomForest
randomForest 4.6-12
Type rfNews() to see new features/changes/bug fixes.
Loading required package: gbm
Loading required package: survival
Loading required package: lattice
Loading required package: splines
Loading required package: parallel
Loaded gbm 2.1.1
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/BigTSP/tsp.tree.Rd_%03d_medium.png", width=480, height=480)
> ### Name: tsp.tree
> ### Title: Fit a Classification Tree based on Top Scoring Pairs.
> ### Aliases: tsp.tree
> 
> ### ** Examples
> 
> library(tree)
> x=matrix(rnorm(100*20),100,20)
> y=rbinom(100,1,0.5)
> y=as.factor(y)
> data=data.frame(y,x)
> tr=tsp.tree(x,y)
> predict(tr,data[1:10,])
     0   1
1  1.0 0.0
2  0.0 1.0
3  1.0 0.0
4  1.0 0.0
5  1.0 0.0
6  1.0 0.0
7  0.5 0.5
8  1.0 0.0
9  1.0 0.0
10 0.0 1.0
> plot(tr)
> text(tr)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>