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  17.3  6.48 0.000412
#>  2 1              2  15.2  7.33 0.00231 
#>  3 1              3  16.4  8.17 0.00856 
#>  4 1              4  15    9.01 0.0209  
#>  5 1              5  18.7  9.86 0.0340  
#>  6 1              6  18.1 10.7  0.0376  
#>  7 1              7  10.4 11.5  0.0316  
#>  8 1              8  10.4 12.4  0.0286  
#>  9 1              9  15   13.2  0.0391  
#> 10 1             10  21.4 14.1  0.0607  
#> # ℹ 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  14.7  6.80 0.000150
#>  2 1              2  21.5  8.08 0.00206 
#>  3 1              3  19.2  9.36 0.00914 
#>  4 1              4  26   10.6  0.0131  
#>  5 1              5  22.8 11.9  0.00739 
#>  6 1              6  15   13.2  0.0114  
#>  7 1              7  19.2 14.5  0.0272  
#>  8 1              8  21   15.8  0.0365  
#>  9 1              9  21   17.0  0.0609  
#> 10 1             10  17.3 18.3  0.0977  
#> # ℹ 49,990 more rows