Skip to contents

Fit a rpart model on the provided data.

Usage

# S3 method for InducerRpart
fit(
  .inducer,
  .data,
  formula,
  weights,
  subset,
  na.action = "na.rpart",
  method,
  model = FALSE,
  x = FALSE,
  y = TRUE,
  parms,
  control,
  cost,
  ...
)

Arguments

.inducer

An InducerRpart object. The Inducer which should be used for the fitting.

.data

The data to which the model should be fitted, provided as a Dataset object.

formula

An optional parameter setting the formula argument of an InducerRpart object.

weights

optional case weights.

subset

optional expression saying that only a subset of the rows of the data should be used in the fit.

na.action

the default action deletes all observations for which y is missing, but keeps those in which one or more predictors are missing.

method

one of "anova", "poisson", "class" or "exp". If method is missing then the routine tries to make an intelligent guess

model

if logical: keep a copy of the model frame in the result? If the input value for model is a model frame

x

keep a copy of the x matrix in the result.

y

keep a copy of the dependent variable in the result. If missing and model is supplied this defaults to FALSE.

parms

optional parameters for the splitting function.

control

a list of options that control details of the rpart algorithm

cost

a vector of non-negative costs, one for each variable in the model. Defaults to one for all variables

...

further arguments

Value

An object of class InducerRpart.

Examples

cars.data <- Dataset(data = cars, target = "dist")
inducer <- InducerRpart()
lmfit <- fit.InducerRpart(.inducer = inducer, .data = cars.data)
#> Error in fit.InducerRpart(.inducer = inducer, .data = cars.data): could not find function "fit.InducerRpart"