Learn R Programming

GPLTR (version 1.5)

tree2glm: tree to GLM

Description

fit the PLTR model for a given tree. The tree is coerced into dummy covariates.

Usage

tree2glm(xtree, xdata, Y.name, X.names, family = "binomial")

Value

the pltr fitted model (fit)

Arguments

xtree

a tree inherits from the rpart method

xdata

a data frame containing the variables in the model

Y.name

the name of the dependent variable

X.names

the names of independent variables to consider in the linear part of the glm

family

the glm family considered depending on the type of the dependent variable.

Author

Cyprien Mbogning and Wilson Toussile

Examples

Run this code
if (FALSE) {
##load the data set

data(data_pltr)

## set the parameters

args.rpart <- list(minbucket = 40, 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)
                     
## Coerce a tree into a glm model using the confonding factor                     

fit_glm <- tree2glm(fit_pltr$tree, data_pltr, Y.name, X.names,
                    family = family)
                    
summary(fit_glm)
}      

Run the code above in your browser using DataLab