Learn R Programming

MachineShop (version 1.1.0)

fit: Model Fitting

Description

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

Usage

fit(x, ...)

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

# S3 method for ModelFrame fit(x, model, ...)

# S3 method for recipe fit(x, model, ...)

Arguments

x

defined relationship between model predictors and an outcome. May be a ModelFrame containing a formula, data, and optionally case weights; a formula; or a recipe.

...

arguments passed to other methods.

data

data.frame containing observed predictors and outcomes.

model

MLModel object, constructor function, or character string naming a constructor function that returns an MLModel object.

Value

MLModelFit class object.

Details

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

Variables in a recipe may be used as case weights by defining a "case_weight" role for them.

See Also

ModelFrame, recipe, modelinfo, tune, predict, varimp

Examples

Run this code
# NOT RUN {
## Survival response example
library(survival)
library(MASS)

gbmfit <- fit(Surv(time, status != 2) ~ sex + age + year + thickness + ulcer,
              data = Melanoma, model = GBMModel)
varimp(gbmfit)

# }

Run the code above in your browser using DataLab