# Getting Started with TidyDensity

library(TidyDensity)

## 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.288 -3.37 0.000347 0.613  0.288
#>  2 1              2 -0.944 -3.23 0.000968 0.173 -0.944
#>  3 1              3  0.153 -3.10 0.00239  0.561  0.153
#>  4 1              4  1.05  -2.96 0.00519  0.854  1.05
#>  5 1              5 -0.577 -2.82 0.00997  0.282 -0.577
#>  6 1              6  2.25  -2.68 0.0169   0.988  2.25
#>  7 1              7  1.17  -2.54 0.0254   0.879  1.17
#>  8 1              8 -1.12  -2.40 0.0338   0.132 -1.12
#>  9 1              9  1.56  -2.26 0.0401   0.940  1.56
#> 10 1             10  0.868 -2.13 0.0430   0.807  0.868
#> # ℹ 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")