[R] User-defined functions in rpart
Hugh Chipman
hachipma at icarus.math.uwaterloo.ca
Tue Jun 17 12:58:18 CEST 2003
This question concerns rpart's facility for user-defined functions that
accomplish splitting.
I was interested in modifying the code so that in each terminal node,
a linear regression is fit to the data.
It seems that from the allowable inputs in the user-defined functions,
that this may not be possible, since they have the form:
function(y, wt, parms) (in the case of the "evaluation" function)
function(y, wt, x, parms, continuous) (split function)
The problem is that there seems to be no facility to include an X
matrix (in the split function, x is a vector corresponding to one
predictor). Without that, fitting a linear model in the terminal node
would not be possible.
Is this a correct assesment, or am I missing something?
Has anyone tried to modify rpart to fit linear models in nodes?
--
--
-- Hugh Chipman --
-- Associate Professor, Department of Statistics & Actuarial Science --
-- U. of Waterloo, 200 University Ave. W, Waterloo, Ontario, N2L 3G1 --
-- (519) 888-4567 ext. 6190 Fax: (519) 746-1875 --
-- www.stats.uwaterloo.ca/~hachipma/ hachipman at uwaterloo.ca --
More information about the R-help
mailing list