get_model {tidyfit}R Documentation

Get a fitted model from a tidyfit.models frame

Description

Returns a single fitted model object produced by the underlying fitting algorithm from a tidyfit.models frame based on a given row number.

Usage

get_model(df, ..., .first_row = TRUE)

Arguments

df

a tidyfit.models frame created using m(), regress(), classify() and similar methods

...

arguments passed to dplyr::filter to filter row in 'df' for which the model should be returned. filters can also include columns nested in df$settings.

.first_row

should the first row be returned if the (filtered) df contains multiple rows

Details

This method is a utility to return the object fitted by the underlying algorithm. For instance, when m("lm") is used to create the tidyfit.models frame, the returned object is of class "lm".

Value

An object of the class associated with the underlying fitting algorithm

Author(s)

Johann Pfitzinger

See Also

get_tidyFit method

Examples

# Load data
data("mtcars")

# fit separate models for transmission types
mtcars <- dplyr::group_by(mtcars, am)

fit <- regress(mtcars, mpg ~ ., m("lm"))

# get the model for single row
summary(get_model(fit, am == 0))

# get model by row number
summary(get_model(fit, dplyr::row_number() == 2))


[Package tidyfit version 0.7.4 Index]