FitMod {ModTools} | R Documentation |
Wrapper for Several Model Functions
Description
Popular implementations of algorithms are characterized by partly unconventional implementations of the operating standards in R. For example, the function e1071::SVM()
returns the predicted values as attributes!
FitMod()
is designed as a wrapping function to offer a consistent interface for a selection of most often used classification and regression models.
Usage
FitMod(formula, data, ..., subset, na.action = na.pass, fitfn = NULL)
## S3 method for class 'FitMod'
predict(object, ...)
## S3 method for class 'FitMod'
plot(x, ...)
## S3 method for class 'FitMod'
summary(object, ...)
## S3 method for class 'FitMod'
drop1(object, ...)
Arguments
x |
a fitted object of class |
formula |
a formula expression as for classification and regression models, of the form |
data |
an optional data frame in which to interpret the variables occurring in formula. |
subset |
expression saying which subset of the rows of the data should be used in the fit. All observations are included by default. |
na.action |
a function to filter missing data. |
fitfn |
code for the fitting function to be used for regression or classifying. So far implemented are: |
object |
the model object. |
... |
further arguments passed to the underlying functions. |
Details
The function will in general return the original object, extended by a further class FitMod
, which allows to capture the output and plot routines.
The classifying algorithms will at the minimum offer the predicting options type = c("class", "prob")
additionally to those implemented by the underlying function.
Value
model object as returned by the calculating function extended with the FitMod
class.
Author(s)
Andri Signorell <andri@signorell.net>
See Also
Examples
r.lm <- FitMod(Fertility ~ ., data=swiss, fitfn="lm")
r.logit <- FitMod(diabetes ~ glucose + pressure + mass + age,
data=d.pima, fitfn="logit")
r.svm <- FitMod(diabetes ~ glucose + pressure + mass + age,
data=d.pima, fitfn="svm")