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.43 0.000108
#>  2 1              2  18.1  6.82 0.000940
#>  3 1              3  21.5  8.21 0.00405 
#>  4 1              4  21    9.61 0.00875 
#>  5 1              5  32.4 11.0  0.0107  
#>  6 1              6  19.2 12.4  0.0136  
#>  7 1              7  33.9 13.8  0.0249  
#>  8 1              8  22.8 15.2  0.0371  
#>  9 1              9  24.4 16.6  0.0475  
#> 10 1             10  21   18.0  0.0657  
#> # … with 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  0.952 0.0000656
#>  2 1              2  19.7  2.72  0.000331 
#>  3 1              3  13.3  4.49  0.00129  
#>  4 1              4  27.3  6.25  0.00404  
#>  5 1              5  33.9  8.02  0.0102   
#>  6 1              6  17.8  9.78  0.0213   
#>  7 1              7  19.2 11.6   0.0364   
#>  8 1              8  15   13.3   0.0507   
#>  9 1              9  22.8 15.1   0.0580   
#> 10 1             10  13.3 16.9   0.0568   
#> # … with 49,990 more rows