
Combine Multiple Tidy Distributions of Different Types
Source:R/combine-tidy-distributions-tbl.R
tidy_combine_distributions.Rd
This allows a user to specify any n
number of tidy_
distributions that can be combined into a single tibble. This is the preferred
method for combining multiple distributions of different types, for example
a Gaussian distribution and a Beta distribution.
This generates a single tibble with an added column of dist_type that will give the distribution family name and its associated parameters.
See also
Other Multiple Distribution:
tidy_multi_single_dist()
Examples
tn <- tidy_normal()
tb <- tidy_beta()
tc <- tidy_cauchy()
tidy_combine_distributions(tn, tb, tc)
#> # A tibble: 150 × 8
#> sim_number x y dx dy p q dist_type
#> <fct> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <fct>
#> 1 1 1 1.06 -3.22 0.000492 0.856 1.06 Gaussian c(0, 1)
#> 2 1 2 0.826 -3.10 0.00147 0.796 0.826 Gaussian c(0, 1)
#> 3 1 3 0.0471 -2.99 0.00382 0.519 0.0471 Gaussian c(0, 1)
#> 4 1 4 -1.02 -2.87 0.00865 0.154 -1.02 Gaussian c(0, 1)
#> 5 1 5 -1.60 -2.76 0.0171 0.0551 -1.60 Gaussian c(0, 1)
#> 6 1 6 -0.238 -2.65 0.0295 0.406 -0.238 Gaussian c(0, 1)
#> 7 1 7 0.0404 -2.53 0.0447 0.516 0.0404 Gaussian c(0, 1)
#> 8 1 8 0.382 -2.42 0.0600 0.649 0.382 Gaussian c(0, 1)
#> 9 1 9 -0.884 -2.30 0.0719 0.188 -0.884 Gaussian c(0, 1)
#> 10 1 10 0.548 -2.19 0.0783 0.708 0.548 Gaussian c(0, 1)
#> # ℹ 140 more rows
## OR
tidy_combine_distributions(
tidy_normal(),
tidy_beta(),
tidy_cauchy(),
tidy_logistic()
)
#> # A tibble: 200 × 8
#> sim_number x y dx dy p q dist_type
#> <fct> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <fct>
#> 1 1 1 -0.972 -3.47 0.000324 0.165 -0.972 Gaussian c(0, 1)
#> 2 1 2 0.660 -3.33 0.000853 0.745 0.660 Gaussian c(0, 1)
#> 3 1 3 -2.13 -3.20 0.00202 0.0166 -2.13 Gaussian c(0, 1)
#> 4 1 4 0.616 -3.06 0.00432 0.731 0.616 Gaussian c(0, 1)
#> 5 1 5 -0.0514 -2.92 0.00836 0.480 -0.0514 Gaussian c(0, 1)
#> 6 1 6 0.443 -2.78 0.0147 0.671 0.443 Gaussian c(0, 1)
#> 7 1 7 -0.198 -2.65 0.0237 0.422 -0.198 Gaussian c(0, 1)
#> 8 1 8 -1.20 -2.51 0.0352 0.116 -1.20 Gaussian c(0, 1)
#> 9 1 9 -0.966 -2.37 0.0492 0.167 -0.966 Gaussian c(0, 1)
#> 10 1 10 -1.34 -2.24 0.0654 0.0894 -1.34 Gaussian c(0, 1)
#> # ℹ 190 more rows