An interface to several of the most often used model-fitting routines designed to make it easy to construct.
Usage
model_train(
data,
tilde,
family = c("auto", "lm", "linear", "binomial", "poisson", "rlm")
)
Arguments
- data
Data frame to use as training data
- tilde
Formula for the model
- family
Character string: the family of model to fit, e.g. "lm", "binomial", "poisson", "rlm", ...
Value
An object of class "model_object". This is much the same as an "lm" or "glm" object
but with the additional attribute of the training data and a printing method that
encourages the use of the regression summary methods conf_interval()
, R2()
, or anova_summary()
Details
Since data may be piped into this function, the training data frame will be called simply "data", the name of the first argument to this function. In order to be able to access the training data in such cases, the training data is assigned to an attribute of the resulting model, "training_data".