Learn R Programming

MachineShop (version 3.5.0)

ModelFrame: ModelFrame Class

Description

Class for storing data, formulas, and other attributes for MachineShop model fitting.

Usage

ModelFrame(...)

# S3 method for formula ModelFrame( formula, data, groups = NULL, strata = NULL, weights = NULL, na.rm = TRUE, ... )

# S3 method for matrix ModelFrame( x, y = NULL, offsets = NULL, groups = NULL, strata = NULL, weights = NULL, na.rm = TRUE, ... )

Value

ModelFrame class object that inherits from data.frame.

Arguments

...

arguments passed from the generic function to its methods. The first argument of each ModelFrame 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. In the associated method, arguments groups, strata, and weights will be evaluated as expressions, whose objects are searched for first in the accompanying data environment and, if not found there, next in the calling environment.

groups

vector of values defining groupings of cases to keep together when folds are constructed for cross-validation [default: none].

strata

vector of values to use in conducting stratified resample estimation of model performance [default: none].

weights

numeric vector of non-negative case weights for the y response variable [default: equal weights].

na.rm

logical indicating whether to remove cases with NA values for any of the model variables.

x, y

matrix and object containing predictor and response variables.

offsets

numeric vector, matrix, or data frame of values to be added with a fixed coefficient of 1 to linear predictors in compatible regression models.

See Also

fit, resample, response, SelectedInput

Examples

Run this code
# \donttest{
## Requires prior installation of suggested package gbm to run

mf <- ModelFrame(ncases / (ncases + ncontrols) ~ agegp + tobgp + alcgp,
                 data = esoph, weights = ncases + ncontrols)
gbm_fit <- fit(mf, model = GBMModel)
varimp(gbm_fit)
# }

Run the code above in your browser using DataLab