Example
This is a basic example which shows you how easy it is to generate data with TidyDensity:
library(TidyDensity)
library(dplyr)
library(ggplot2)
tidy_normal()
#> # A tibble: 50 × 7
#> sim_number x y dx dy p q
#> <fct> <int> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 1 -0.392 -3.23 0.000243 0.348 -0.392
#> 2 1 2 0.890 -3.08 0.000730 0.813 0.890
#> 3 1 3 0.644 -2.93 0.00190 0.740 0.644
#> 4 1 4 0.524 -2.79 0.00432 0.700 0.524
#> 5 1 5 -0.951 -2.64 0.00864 0.171 -0.951
#> 6 1 6 -0.324 -2.50 0.0155 0.373 -0.324
#> 7 1 7 -0.247 -2.35 0.0254 0.402 -0.247
#> 8 1 8 0.487 -2.20 0.0392 0.687 0.487
#> 9 1 9 -0.442 -2.06 0.0584 0.329 -0.442
#> 10 1 10 -0.171 -1.91 0.0845 0.432 -0.171
#> # ℹ 40 more rows
An example plot of the tidy_normal
data.
tn <- tidy_normal(.n = 100, .num_sims = 6)
tidy_autoplot(tn, .plot_type = "density")
tidy_autoplot(tn, .plot_type = "quantile")
tidy_autoplot(tn, .plot_type = "probability")
tidy_autoplot(tn, .plot_type = "qq")
We can also take a look at the plots when the number of simulations is greater than nine. This will automatically turn off the legend as it will become too noisy.
tn <- tidy_normal(.n = 100, .num_sims = 20)
tidy_autoplot(tn, .plot_type = "density")
tidy_autoplot(tn, .plot_type = "quantile")
tidy_autoplot(tn, .plot_type = "probability")
tidy_autoplot(tn, .plot_type = "qq")