Last chance! 50% off unlimited learning
Sale ends in
rpart
modelrpart(formula, data, weights, subset, na.action=na.rpart, method,
model=F, x=F, y=T, parms, control=rpart.control(...), ...)
lm
function.y
is missing,
but keeps those in which one or more predictors are missing."anova"
, "poisson"
, "class"
or "exp"
.
If method
is missing then the routine tries to make an intellegent guess.
If y
is a survival object, then method="exp"
model
is a model frame (likely from an earlier
call to the rpart
function), then this frame is used rather than constructing
new data.x
matrix in the result.rpart
algorithm.rpart.control
may also be specified in the call to rpart
.rpart
, a superset of class tree
.tree
function mainly in its handling of surrogate
variables. In most details it follows Breiman et. al. quite closely.rpart.control
, rpart.object
,
summary.rpart
, print.rpart
data(kyphosis)
fit <- rpart(Kyphosis ~ Age + Number + Start, data=kyphosis)
fit2 <- rpart(Kyphosis ~ Age + Number + Start, data=kyphosis,
parms=list(prior=c(.65,.35), split='information'))
fit3 <- rpart(Kyphosis ~ Age + Number + Start, data=kyphosis,
control=rpart.control(cp=.05))
par(mfrow=c(1,2))
plot(fit)
text(fit, use.n=T)
plot(fit2)
text(fit2, use.n=T)
Run the code above in your browser using DataLab