Skip to contents

Add density information to the output of tidy_bootstrap(), and bootstrap_unnest_tbl().

Usage

bootstrap_density_augment(.data)

Arguments

.data

The data that is passed from the tidy_bootstrap() or bootstrap_unnest_tbl() functions.

Value

A tibble

Details

This function takes as input the output of the tidy_bootstrap() or bootstrap_unnest_tbl() and returns an augmented tibble that has the following columns added to it: x, y, dx, and dy.

It looks for an attribute that comes from using tidy_bootstrap() or bootstrap_unnest_tbl() so it will not work unless the data comes from one of those functions.

Author

Steven P. Sanderson II, MPH

Examples

x <- mtcars$mpg

tidy_bootstrap(x) %>%
  bootstrap_density_augment()
#> # A tibble: 50,000 × 5
#>    sim_number     x     y    dx       dy
#>    <fct>      <int> <dbl> <dbl>    <dbl>
#>  1 1              1  22.8  5.26 0.000144
#>  2 1              2  15.5  6.78 0.000803
#>  3 1              3  17.8  8.31 0.00334 
#>  4 1              4  15    9.84 0.0104  
#>  5 1              5  19.2 11.4  0.0245  
#>  6 1              6  19.2 12.9  0.0442  
#>  7 1              7  15   14.4  0.0624  
#>  8 1              8  27.3 16.0  0.0720  
#>  9 1              9  21.4 17.5  0.0714  
#> 10 1             10  17.8 19.0  0.0641  
#> # ℹ 49,990 more rows

tidy_bootstrap(x) %>%
  bootstrap_unnest_tbl() %>%
  bootstrap_density_augment()
#> # A tibble: 50,000 × 5
#>    sim_number     x     y    dx       dy
#>    <fct>      <int> <dbl> <dbl>    <dbl>
#>  1 1              1  17.3  5.85 0.000155
#>  2 1              2  27.3  7.37 0.000742
#>  3 1              3  22.8  8.89 0.00270 
#>  4 1              4  14.7 10.4  0.00754 
#>  5 1              5  15.2 11.9  0.0165  
#>  6 1              6  18.7 13.5  0.0289  
#>  7 1              7  21   15.0  0.0423  
#>  8 1              8  19.7 16.5  0.0544  
#>  9 1              9  21.5 18.0  0.0639  
#> 10 1             10  33.9 19.5  0.0686  
#> # ℹ 49,990 more rows