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.465 -2.75 0.000449 0.321 -0.465
#> 2 1 2 0.0208 -2.63 0.00124 0.508 0.0208
#> 3 1 3 -0.463 -2.51 0.00303 0.322 -0.463
#> 4 1 4 -0.581 -2.38 0.00657 0.281 -0.581
#> 5 1 5 -0.347 -2.26 0.0127 0.364 -0.347
#> 6 1 6 2.19 -2.14 0.0219 0.986 2.19
#> 7 1 7 -0.255 -2.02 0.0342 0.399 -0.255
#> 8 1 8 -0.0367 -1.90 0.0489 0.485 -0.0367
#> 9 1 9 -0.567 -1.77 0.0652 0.285 -0.567
#> 10 1 10 -0.882 -1.65 0.0834 0.189 -0.882
#> # ℹ 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")