Obtain residuals from models in a tidyfit.models
frame
Source: R/residuals.tidyfit.models.R
residuals.tidyfit.models.Rd
The function generates residuals for all models in a tidyfit.models
frame and outputs a tidy frame.
Usage
# S3 method for class 'tidyfit.models'
residuals(object, ...)
Details
The function uses the 'model_object' column in a tidyfit.model
frame to return residuals for each model.
Examples
data <- dplyr::group_by(tidyfit::Factor_Industry_Returns, Industry)
fit <- regress(data, Return ~ ., m("lm"), .mask = "Date")
resid(fit)
#> # A tibble: 7,080 × 3
#> # Groups: Industry, model [10]
#> Industry model residual
#> <chr> <chr> <dbl>
#> 1 Durbl lm 0.719
#> 2 Durbl lm -0.270
#> 3 Durbl lm 1.91
#> 4 Durbl lm 6.63
#> 5 Durbl lm -4.52
#> 6 Durbl lm -1.67
#> 7 Durbl lm -2.50
#> 8 Durbl lm -0.856
#> 9 Durbl lm -2.33
#> 10 Durbl lm 2.74
#> # ℹ 7,070 more rows