CART {sharp}R Documentation

Classification And Regression Trees

Description

Runs decision trees using implementation from rpart. This function is not using stability.

Usage

CART(xdata, ydata, Lambda = NULL, family, ...)

Arguments

xdata

matrix of predictors with observations as rows and variables as columns.

ydata

optional vector or matrix of outcome(s). If family is set to "binomial" or "multinomial", ydata can be a vector with character/numeric values or a factor.

Lambda

matrix of parameters controlling the number of splits in the decision tree.

family

type of regression model. This argument is defined as in glmnet. Possible values include "gaussian" (linear regression), "binomial" (logistic regression), "multinomial" (multinomial regression), and "cox" (survival analysis).

...

additional parameters passed to rpart.

Value

A list with:

selected

matrix of binary selection status. Rows correspond to different model parameters. Columns correspond to predictors.

beta_full

array of model coefficients. Rows correspond to different model parameters. Columns correspond to predictors. Indices along the third dimension correspond to outcome variable(s).

References

Breiman L, Friedman JH, Olshen R, Stone CJ (1984). Classification and Regression Trees. Wadsworth.

See Also

SelectionAlgo, VariableSelection

Other underlying algorithm functions: ClusteringAlgo(), PenalisedGraphical(), PenalisedOpenMx(), PenalisedRegression()

Examples

if (requireNamespace("rpart", quietly = TRUE)) {
  # Data simulation
  set.seed(1)
  simul <- SimulateRegression(pk = 50)

  # Running the LASSO
  mycart <- CART(
    xdata = simul$xdata,
    ydata = simul$ydata,
    family = "gaussian"
  )
  head(mycart$selected)
}

[Package sharp version 1.4.6 Index]