Learn R Programming

MachineShop (version 3.1.0)

ModelFrame: ModelFrame Class

Description

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

Usage

ModelFrame(x, ...)

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

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

Arguments

x

model formula or matrix of predictor variables. In the case of a formula, arguments weights and strata are evaluated as expressions, whose objects are searched for first in the accompanying data environment and, if not found there, next in the calling environment.

...

arguments passed to other methods.

data

data frame or an object that can be converted to one.

na.rm

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

weights

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

strata

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

y

response variable.

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.

Value

ModelFrame class object that inherits from data.frame.

See Also

fit, resample, response, SelectedInput

Examples

Run this code
# NOT RUN {
## 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)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab