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  24.4  1.50 0.000123
#>  2 1              2  19.2  3.22 0.000598
#>  3 1              3  22.8  4.94 0.00214 
#>  4 1              4  10.4  6.66 0.00575 
#>  5 1              5  19.2  8.38 0.0122  
#>  6 1              6  14.3 10.1  0.0220  
#>  7 1              7  15.2 11.8  0.0352  
#>  8 1              8  15.5 13.5  0.0495  
#>  9 1              9  10.4 15.3  0.0594  
#> 10 1             10  30.4 17.0  0.0612  
#> # ℹ 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  4.58 0.0000931
#>  2 1              2  15.2  6.04 0.000681 
#>  3 1              3  18.7  7.51 0.00293  
#>  4 1              4  14.7  8.97 0.00791  
#>  5 1              5  21.5 10.4  0.0157   
#>  6 1              6  32.4 11.9  0.0268   
#>  7 1              7  10.4 13.4  0.0393   
#>  8 1              8  33.9 14.8  0.0469   
#>  9 1              9  26   16.3  0.0526   
#> 10 1             10  18.7 17.8  0.0654   
#> # ℹ 49,990 more rows