Store residuals from a model

# S3 method for model
store(dataset, object, name = "residuals", ...)

Arguments

dataset

Dataset to append residuals to

object

Return value from a model function

name

Variable name(s) assigned to model residuals

...

Additional arguments

Details

The store method for objects of class "model". Adds model residuals to the dataset while handling missing values and filters. See https://radiant-rstats.github.io/docs/model/regress.html for an example in Radiant

Examples

regress(diamonds, rvar = "price", evar = c("carat", "cut"), data_filter = "price > 1000") %>% store(diamonds, ., name = "resid") %>% head()
#> # A tibble: 6 x 12 #> price carat clarity cut color depth table x y z date resid #> <int> <dbl> <fct> <fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <date> <dbl> #> 1 580 0.32 VS1 Ideal H 61 56 4.43 4.45 2.71 2012-02-26 NA #> 2 650 0.34 SI1 Very… G 63.4 57 4.45 4.42 2.81 2012-02-26 NA #> 3 630 0.3 VS2 Very… G 63.1 58 4.27 4.23 2.68 2012-02-26 NA #> 4 706 0.35 VVS2 Ideal H 59.2 56 4.6 4.65 2.74 2012-02-26 NA #> 5 1080 0.4 VS2 Prem… F 62.6 58 4.72 4.68 2.94 2012-02-26 877. #> 6 3082 0.6 VVS1 Ideal E 62.5 53.7 5.35 5.43 3.38 2012-02-26 595.