Learn R Programming

BigTSP (version 1.0)

tsp.tree: 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 "" 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.

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

Run this code
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)

Run the code above in your browser using DataLab