augment.nested_model_fit {nestedmodels} | R Documentation |
Augment data with predictions
Description
generics::augment()
method for nested models. augment.nested_model_fit()
will add column(s) for predictions to the given data.
Usage
## S3 method for class 'nested_model_fit'
augment(x, new_data, ...)
Arguments
x |
A |
new_data |
A data frame - can be nested or non-nested. |
... |
Passed onto |
Value
A data frame with one or more added columns for predictions.
See Also
Examples
library(dplyr)
library(tidyr)
library(parsnip)
data <- filter(example_nested_data, id %in% 1:5)
nested_data <- nest(data, data = -c(id, id2))
model <- linear_reg() %>%
set_engine("lm") %>%
nested()
fitted <- fit(model, z ~ x + y + a + b, nested_data)
augment(fitted, example_nested_data)
[Package nestedmodels version 1.1.0 Index]