broomify: Broomify a model

Description Usage Arguments Value Examples

View source: R/ggnostic.R

Description

broom::augment a model and add broom::glance and broom::tidy output as attributes. X and Y variables are also added.

Usage

1
broomify(model, lmStars = TRUE)

Arguments

model

model to be sent to broom::augment, broom::glance, and broom::tidy

lmStars

boolean that determines if stars are added to labels

Value

broom::augmented data frame with the broom::glance data.frame and broom::tidy data.frame as 'broom_glance' and 'broom_tidy' attributes respectively. var_x and var_y variables are also added as attributes

Examples

1
2
3
4
data(mtcars)
model <- stats::lm(mpg ~ wt + qsec + am, data = mtcars)
broomified_model <- broomify(model)
str(broomified_model)

Example output

Loading required package: broom
Warning messages:
1: Deprecated: please use `purrr::possibly()` instead 
2: Deprecated: please use `purrr::possibly()` instead 
3: Deprecated: please use `purrr::possibly()` instead 
4: Deprecated: please use `purrr::possibly()` instead 
5: Deprecated: please use `purrr::possibly()` instead 
Classes 'broomify' and 'data.frame':	32 obs. of  12 variables:
 $ .rownames : chr  "Mazda RX4" "Mazda RX4 Wag" "Datsun 710" "Hornet 4 Drive" ...
 $ mpg       : num  21 21 22.8 21.4 18.7 18.1 14.3 24.4 22.8 19.2 ...
 $ wt        : num  2.62 2.88 2.32 3.21 3.44 ...
 $ qsec      : num  16.5 17 18.6 19.4 17 ...
 $ am        : num  1 1 1 0 0 0 0 0 0 0 ...
 $ .fitted   : num  22.5 22.2 26.3 20.9 17 ...
 $ .se.fit   : num  0.72 0.744 0.76 0.685 0.749 ...
 $ .resid    : num  -1.47 -1.158 -3.481 0.543 1.69 ...
 $ .hat      : num  0.0857 0.0914 0.0955 0.0776 0.0927 ...
 $ .sigma    : num  2.49 2.49 2.4 2.5 2.48 ...
 $ .cooksd   : num  0.00916 0.00614 0.05847 0.00111 0.0133 ...
 $ .std.resid: num  -0.625 -0.494 -1.489 0.23 0.722 ...
 - attr(*, "broom_glance")='data.frame':	1 obs. of  11 variables:
  ..$ r.squared    : num 0.85
  ..$ adj.r.squared: num 0.834
  ..$ sigma        : num 2.46
  ..$ statistic    : num 52.7
  ..$ p.value      : num 1.21e-11
  ..$ df           : int 4
  ..$ logLik       : num -72.1
  ..$ AIC          : num 154
  ..$ BIC          : num 161
  ..$ deviance     : num 169
  ..$ df.residual  : int 28
 - attr(*, "broom_tidy")='data.frame':	4 obs. of  5 variables:
  ..$ term     : chr  "(Intercept)" "wt" "qsec" "am"
  ..$ estimate : num  9.62 -3.92 1.23 2.94
  ..$ std.error: num  6.96 0.711 0.289 1.411
  ..$ statistic: num  1.38 -5.51 4.25 2.08
  ..$ p.value  : num  1.78e-01 6.95e-06 2.16e-04 4.67e-02
 - attr(*, "var_x")= chr  "wt" "qsec" "am"
 - attr(*, "var_y")= chr "mpg"
 - attr(*, "var_x_label")= chr  "wt***" "qsec***" "am*"

GGally documentation built on May 18, 2018, 1:08 a.m.