fit_model | R Documentation |
fit_model()
takes a model_spec object from {parsnip} and
it fits is. Then, usual methods like summary()
, or coef()
can be applied
directly on it, while it can still be used as the {tidymodels} recommends it.
fit_model(data, formula, ..., type = NULL, env = parent.frame())
## S3 method for class 'model_fit'
summary(object, ...)
## S3 method for class 'model_fit'
anova(object, ...)
## S3 method for class 'model_fit'
plot(x, y, ...)
## S3 method for class 'model_fit'
chart(data, ..., type = "model", env = parent.frame())
## S3 method for class 'model_fit'
as.function(x, ...)
## S3 method for class 'model_fit'
coef(object, ...)
## S3 method for class 'model_fit'
vcov(object, ...)
## S3 method for class 'model_fit'
confint(object, parm, level = 0.95, ...)
## S3 method for class 'model_fit'
fitted(object, ...)
## S3 method for class 'model_fit'
residuals(object, ...)
## S3 method for class 'model_fit'
rstandard(model, ...)
## S3 method for class 'model_fit'
cooks.distance(model, ...)
## S3 method for class 'model_fit'
hatvalues(model, ...)
## S3 method for class 'model_fit'
deviance(object, ...)
## S3 method for class 'model_fit'
AIC(object, ..., k = 2)
## S3 method for class 'model_fit'
BIC(object, ...)
## S3 method for class 'model_fit'
family(object, ...)
## S3 method for class 'model_fit'
nobs(object, ...)
## S3 method for class 'model_fit'
formula(x, ...)
## S3 method for class 'model_fit'
variable.names(object, ...)
## S3 method for class 'model_fit'
labels(object, ...)
data |
A data frame (or a model_fit object for |
formula |
A formula specifying a model |
... |
Further arguments passed to the method |
type |
The type of model fitting, specified by a model_spec object or the name of such an object in a string |
env |
The environment where to evaluate |
object |
A model_fit object |
x |
Idem |
y |
Not used here |
parm |
Specification of parameters for the confidence intervals (vector of numbers or of names). If missing, all parameters are considered. |
level |
Confidence level required. |
model |
Idem |
k |
The penalty per parameter to be used in the AIC (by default, |
A model_fit object.
library(parsnip)
data(trees, package = "datasets")
# Take the habit to prefix your regression model specs by `reg_`
reg_lm <- linear_reg(mod = "regression", engine = "lm")
trees_fit <- fit_model$reg_lm(data = trees, Volume ~ Girth)
# You can use summary(), AIC(), anova(), tidy(), glance(), etc. directly
summary(trees_fit)
anova(trees_fit)
AIC(trees_fit)
coef(trees_fit)
library(chart)
chart(trees_fit)
# etc.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.