
Generate Tidy Data from Triangular Distribution
Source:R/random-tidy-triangular.R
tidy_triangular.Rd
This function generates tidy data from the triangular distribution.
Usage
tidy_triangular(
.n = 50,
.min = 0,
.max = 1,
.mode = 1/2,
.num_sims = 1,
.return_tibble = TRUE
)
Arguments
- .n
The number of x values for each simulation.
- .min
The minimum value of the triangular distribution.
- .max
The maximum value of the triangular distribution.
- .mode
The mode (peak) value of the triangular distribution.
- .num_sims
The number of simulations to perform.
- .return_tibble
A logical value indicating whether to return the result as a tibble. Default is TRUE.
Details
The function takes parameters for the triangular distribution
(minimum, maximum, mode), the number of x values (n
), the number of
simulations (num_sims
), and an option to return the result as a tibble
(return_tibble
). It performs various checks on the input parameters to ensure
validity. The result is a data frame or tibble with tidy data for
further analysis.
See also
Other Continuous Distribution:
tidy_beta()
,
tidy_burr()
,
tidy_cauchy()
,
tidy_chisquare()
,
tidy_exponential()
,
tidy_f()
,
tidy_gamma()
,
tidy_generalized_beta()
,
tidy_generalized_pareto()
,
tidy_inverse_burr()
,
tidy_inverse_exponential()
,
tidy_inverse_gamma()
,
tidy_inverse_normal()
,
tidy_inverse_pareto()
,
tidy_inverse_weibull()
,
tidy_logistic()
,
tidy_lognormal()
,
tidy_normal()
,
tidy_paralogistic()
,
tidy_pareto()
,
tidy_pareto1()
,
tidy_t()
,
tidy_uniform()
,
tidy_weibull()
,
tidy_zero_truncated_geometric()
Other Triangular:
util_triangular_param_estimate()
,
util_triangular_stats_tbl()
Examples
tidy_triangular(.return_tibble = TRUE)
#> # A tibble: 50 × 7
#> sim_number x y dx dy p q
#> <fct> <int> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 1 0.654 -0.270 0.00145 0.760 0.654
#> 2 1 2 0.168 -0.240 0.00376 0.0567 0.168
#> 3 1 3 0.164 -0.210 0.00880 0.0540 0.164
#> 4 1 4 0.310 -0.180 0.0187 0.192 0.310
#> 5 1 5 0.653 -0.150 0.0361 0.759 0.653
#> 6 1 6 0.529 -0.119 0.0639 0.557 0.529
#> 7 1 7 0.127 -0.0894 0.104 0.0325 0.127
#> 8 1 8 0.584 -0.0593 0.157 0.654 0.584
#> 9 1 9 0.496 -0.0293 0.224 0.493 0.496
#> 10 1 10 0.344 0.000812 0.302 0.237 0.344
#> # ℹ 40 more rows