predict.tidyfit.models {tidyfit}R Documentation

Predict using a tidyfit.models frame

Description

The function generates predictions for all models in a tidyfit.models frame and outputs a tidy frame.

Usage

## S3 method for class 'tidyfit.models'
predict(object, newdata, ..., .keep_grid_id = FALSE)

Arguments

object

model.frame created using regress, classify or m

newdata

New values at which predictions are to made

...

currently not used

.keep_grid_id

boolean. By default the grid ID column is dropped, if there is only one unique setting per model or group. .keep_grid_id = TRUE ensures that the column is never dropped.

Details

The function uses the 'model_object' column in a tidyfit.model frame to return predictions using the newdata argument for each model.

When the response variable is found in newdata, it is automatically included as a 'truth' column.

Value

A 'tibble'.

Author(s)

Johann Pfitzinger

See Also

coef.tidyfit.models, residuals.tidyfit.models and fitted.tidyfit.models

Examples

data <- dplyr::group_by(tidyfit::Factor_Industry_Returns, Industry)
fit <- regress(data, Return ~ ., m("lm"), .mask = "Date")
predict(fit, data)


[Package tidyfit version 0.7.1 Index]