Learn R Programming

rpart (version 4.0-3)

rpart.object: Recursive Partitioning and Regression Trees Object

Description

These are objects representing fitted rpart trees.

Arguments

Value

  • framedata frame with one row for each node in the tree. The row.names of frame contain the (unique) node numbers that follow a binary ordering indexed by node depth. Columns of frame include var, a factor giving the name of the variable used in the split at each node (leaf nodes are denoted by the string ), n, the size of each node, wt, the sum of case weights for the node, dev, the deviance of each node, yval, the fitted value of the response at each node, and splits, a two column matrix of left and right split labels for each node.

    Extra response information is in yval2, which contains the number of events at the node (poisson), or a matrix containing the fitted class, the class counts for each node and the class probabilities (classification). Also included in the frame are complexity, the complexity parameter at which this split will collapse, ncompete, the number of competitor splits retained, and nsurrogate, the number of surrogate splits retained.

  • whereinteger vector, the same length as the number of observations in the root node, containing the row number of frame corresponding to the leaf node that each observation falls into.
  • splitsa numeric matrix describing the splits. The row label is the name of the split variable, and columns are count, the number of observations sent left or right by the split (for competitor splits this is the number that would have been sent left or right had this split been used, for surrogate splits it is the number missing the primary split variable which were decided using this surrogate), ncat, the number of categories or levels for the variable (+/-1 for a continuous variable), improve, which is the improvement in deviance given by this split, or, for surrogates, the concordance of the surrogate with the primary, and index, the numeric split point. The last column adj gives the adjusted concordance for surrogate splits. For a factor, the index column contains the row number of the csplit matrix. For a continuous variable, the sign of ncat determines whether the subset x < cutpoint or x > cutpoint is sent to the left. For rows with zero count the rest of the row should be ignored as no split was computed.
  • csplitan integer matrix. This will be present only if one of the split variables is a factor (included ordered factors). There is a row for each such split, and the number of columns is the largest number of levels in the factors. Which row is given by the index column of the splits matrix. The columns record 1 if that level of the factor goes to the left, 3 if it goes to the right, and 2 if that level is not present at this node of the tree (or not defined for the factor).
  • methodthe method used to grow the tree.
  • cptablethe table of optimal prunings based on a complexity parameter.
  • variable.importancea vector giving the importance of each variable. When printed by summary.rpart these are rescaled to add to 100.
  • termsan object of mode expression and class "term" summarizing the formula. Used by various methods, but typically not of direct relevance to users.
  • callan image of the call that produced the object, but with the arguments all named and with the actual formula included as the formula argument. To re-evaluate the call, say update(tree). Optional components include the matrix of predictors (x) and the response variable (y) used to construct the rpart object.

Structure

The following components must be included in a legitimate rpart object. Of these, only the where component has the same length as the data used to fit the rpart object. The internal structures were changed in rpart 4.0-x: the descriptions here may not have caught up.

See Also

rpart.