fit-methods: Model Fitting

fitR Documentation

Model Fitting


Fit a model to estimate its parameters from a data set.



## S3 method for class 'formula'
fit(formula, data, model, ...)

## S3 method for class 'matrix'
fit(x, y, model, ...)

## S3 method for class 'ModelFrame'
fit(input, model = NULL, ...)

## S3 method for class 'recipe'
fit(input, model = NULL, ...)

## S3 method for class 'ModelSpecification'
fit(object, verbose = FALSE, ...)

## S3 method for class 'MLModel'
fit(model, ...)

## S3 method for class 'MLModelFunction'
fit(model, ...)



arguments passed from the generic function to its methods, from the MLModel and MLModelFunction methods to first arguments of others, and from others to the ModelSpecification method. The first argument of each fit method is positional and, as such, must be given first in calls to them.

formula, data

formula defining the model predictor and response variables and a data frame containing them.


model function, function name, or object; or another object that can be coerced to a model. A model can be given first followed by any of the variable specifications.

x, y

matrix and object containing predictor and response variables.


input object defining and containing the model predictor and response variables.


model specification.


logical indicating whether to display printed output generated by some model-specific fit functions to aid in monitoring progress and diagnosing errors.


User-specified case weights may be specified for ModelFrames upon creation with the weights argument in its constructor.

Variables in recipe specifications may be designated as case weights with the role_case function.


MLModelFit class object.

See Also

as.MLModel, response, predict, varimp


## Requires prior installation of suggested package gbm to run

## Survival response example

gbm_fit <- fit(Surv(time, status) ~ ., data = veteran, model = GBMModel)

MachineShop documentation built on Sept. 5, 2022, 5:08 p.m.