tree2indicators: From a tree to indicators (or dummy variables)

View source: R/tree2indicators.R

tree2indicatorsR Documentation

From a tree to indicators (or dummy variables)

Description

Coerces a given tree structure to binary covariates.

Usage

tree2indicators(fit)

Arguments

fit

a tree structure inheriting to the rpart method

Value

a list of indicators

Author(s)

Cyprien Mbogning and Wilson Toussile

Examples

## Not run: 
## load the data set

data(data_pltr)

## set the parameters

args.rpart <- list(minbucket = 40, xval = 10, cp = 0)
family <- "binomial"
Y.name <- "Y"
X.names <- "G1"
G.names <- paste("G", 2:15, sep="")

## build a maximal tree

fit_pltr <- pltr.glm(data_pltr, Y.name, X.names, G.names, args.rpart = args.rpart,
                     family = family,iterMax = 5, iterMin = 3)

## Compute a list of indicator from the leaves of the tree fitted tree

tree2indicators(fit_pltr$tree)

## End(Not run)

GPLTR documentation built on Aug. 27, 2023, 1:06 a.m.