Skip to contents

Generate multiple distributions of data from the same tidy_ distribution function.

Usage

tidy_multi_single_dist(.tidy_dist = NULL, .param_list = list())

Arguments

.tidy_dist

The type of tidy_ distribution that you want to run. You can only choose one.

.param_list

This must be a list() object of the parameters that you want to pass through to the TidyDensity tidy_ distribution function.

Value

A tibble

Details

Generate multiple distributions of data from the same tidy_ distribution function. This allows you to simulate multiple distributions of the same family in order to view how shapes change with parameter changes. You can then visualize the differences however you choose.

See also

Other Multiple Distribution: tidy_combine_distributions()

Author

Steven P. Sanderson II, MPH

Examples


tidy_multi_single_dist(
  .tidy_dist = "tidy_normal",
  .param_list = list(
    .n = 50,
    .mean = c(-1, 0, 1),
    .sd = 1,
    .num_sims = 3,
    .return_tibble = TRUE
  )
)
#> # A tibble: 450 × 8
#>    sim_number dist_name             x      y    dx       dy      p      q
#>    <fct>      <fct>             <int>  <dbl> <dbl>    <dbl>  <dbl>  <dbl>
#>  1 1          Gaussian c(-1, 1)     1 -1.00  -4.51 0.000224 0.499  -1.00 
#>  2 1          Gaussian c(-1, 1)     2 -1.21  -4.37 0.000584 0.417  -1.21 
#>  3 1          Gaussian c(-1, 1)     3 -1.55  -4.23 0.00136  0.291  -1.55 
#>  4 1          Gaussian c(-1, 1)     4 -2.00  -4.10 0.00285  0.159  -2.00 
#>  5 1          Gaussian c(-1, 1)     5 -0.998 -3.96 0.00537  0.501  -0.998
#>  6 1          Gaussian c(-1, 1)     6 -1.80  -3.82 0.00915  0.211  -1.80 
#>  7 1          Gaussian c(-1, 1)     7 -0.949 -3.69 0.0143   0.520  -0.949
#>  8 1          Gaussian c(-1, 1)     8 -1.42  -3.55 0.0207   0.336  -1.42 
#>  9 1          Gaussian c(-1, 1)     9 -2.30  -3.42 0.0288   0.0960 -2.30 
#> 10 1          Gaussian c(-1, 1)    10 -1.35  -3.28 0.0392   0.365  -1.35 
#> # ℹ 440 more rows

tidy_multi_single_dist(
  .tidy_dist = "tidy_normal",
  .param_list = list(
    .n = 50,
    .mean = c(-1, 0, 1),
    .sd = 1,
    .num_sims = 3,
    .return_tibble = FALSE
  )
)
#>      sim_number         dist_name     x          y        dx           dy
#>          <fctr>            <fctr> <int>      <num>     <num>        <num>
#>   1:          1 Gaussian c(-1, 1)     1 -1.1246093 -4.795337 0.0002178942
#>   2:          1 Gaussian c(-1, 1)     2 -0.1464203 -4.641775 0.0006045876
#>   3:          1 Gaussian c(-1, 1)     3 -2.6360620 -4.488213 0.0014859375
#>   4:          1 Gaussian c(-1, 1)     4 -1.7831379 -4.334651 0.0032434431
#>   5:          1 Gaussian c(-1, 1)     5 -1.5017047 -4.181089 0.0063089364
#>  ---                                                                     
#> 446:          3  Gaussian c(1, 1)    46 -0.2268759  4.237218 0.0067100536
#> 447:          3  Gaussian c(1, 1)    47  0.5696987  4.375429 0.0035494345
#> 448:          3  Gaussian c(1, 1)    48  1.1117364  4.513640 0.0016472812
#> 449:          3  Gaussian c(1, 1)    49 -0.3629532  4.651851 0.0006702934
#> 450:          3  Gaussian c(1, 1)    50 -0.2865964  4.790063 0.0002390150
#>               p          q
#>           <num>      <num>
#>   1: 0.45041645 -1.1246093
#>   2: 0.80333106 -0.1464203
#>   3: 0.05091331 -2.6360620
#>   4: 0.21677307 -1.7831379
#>   5: 0.30793764 -1.5017047
#>  ---                      
#> 446: 0.10993461 -0.2268759
#> 447: 0.33348825  0.5696987
#> 448: 0.54448378  1.1117364
#> 449: 0.08644864 -0.3629532
#> 450: 0.09911749 -0.2865964