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  21    5.57 0.000123
#>  2 1              2  17.8  7.01 0.000654
#>  3 1              3  21    8.45 0.00263 
#>  4 1              4  32.4  9.89 0.00804 
#>  5 1              5  14.7 11.3  0.0187  
#>  6 1              6  15.2 12.8  0.0337  
#>  7 1              7  24.4 14.2  0.0479  
#>  8 1              8  22.8 15.7  0.0568  
#>  9 1              9  21.4 17.1  0.0617  
#> 10 1             10  13.3 18.5  0.0669  
#> # ℹ 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  19.7  6.63 0.000140
#>  2 1              2  14.7  8.05 0.000935
#>  3 1              3  30.4  9.46 0.00440 
#>  4 1              4  18.7 10.9  0.0146  
#>  5 1              5  15.2 12.3  0.0343  
#>  6 1              6  15.5 13.7  0.0572  
#>  7 1              7  14.7 15.1  0.0704  
#>  8 1              8  15.5 16.5  0.0703  
#>  9 1              9  18.1 17.9  0.0682  
#> 10 1             10  21.5 19.4  0.0703  
#> # ℹ 49,990 more rows