Skip to contents

# Tidy Distribution Summary Statistics Tibble

Source: `R/tidy_distribution_summary_tbl.R`
`tidy_distribution_summary_tbl.Rd`

This function returns a summary statistics tibble. It will use the y column from the `tidy_` distribution function.

## Usage

    tidy_distribution_summary_tbl(.data, ...)

## Arguments

.data

  The data that is going to be passed from a a `tidy_` distribution function.

...

  This is the grouping variable that gets passed to `dplyr::group_by()` and `dplyr::select()`.

## Value

A summary stats tibble

## Details

This function takes in a `tidy_` distribution table and will return a tibble of the following information:

- `sim_number`

- `mean_val`

- `median_val`

- `std_val`

- `min_val`

- `max_val`

- `skewness`

- `kurtosis`

- `range`

- `iqr`

- `variance`

- `ci_hi`

- `ci_lo`

The kurtosis and skewness come from the package `healthyR.ai`

## Author

Steven P. Sanderson II, MPH

## Examples

    library(dplyr)
    #>
    #> Attaching package: 'dplyr'
    #> The following objects are masked from 'package:stats':
    #>
    #>     filter, lag
    #> The following objects are masked from 'package:base':
    #>
    #>     intersect, setdiff, setequal, union

    tn <- tidy_normal(.num_sims = 5)
    tb <- tidy_beta(.num_sims = 5)

    tidy_distribution_summary_tbl(tn)
    #> # A tibble: 1 × 12
    #>   mean_val median_val std_val min_val max_val skewness kurtosis range   iqr
    #>      <dbl>      <dbl>   <dbl>   <dbl>   <dbl>    <dbl>    <dbl> <dbl> <dbl>
    #> 1   -0.106    -0.0414   0.936   -2.71    3.09   0.0808     3.01  5.81  1.35
    #> # ℹ 3 more variables: variance <dbl>, ci_low <dbl>, ci_high <dbl>
    tidy_distribution_summary_tbl(tn, sim_number)
    #> # A tibble: 5 × 13
    #>   sim_number mean_val median_val std_val min_val max_val skewness kurtosis range
    #>   <fct>         <dbl>      <dbl>   <dbl>   <dbl>   <dbl>    <dbl>    <dbl> <dbl>
    #> 1 1           -0.158     -0.0498   0.838   -2.51    1.57  -0.224      2.85  4.08
    #> 2 2           -0.248     -0.284    1.05    -2.71    2.39  -0.0132     3.02  5.11
    #> 3 3            0.0799     0.170    0.889   -1.71    2.22   0.0760     2.57  3.93
    #> 4 4           -0.233     -0.352    0.945   -1.89    3.09   0.844      4.55  4.99
    #> 5 5            0.0309     0.104    0.932   -1.67    1.71  -0.194      1.98  3.39
    #> # ℹ 4 more variables: iqr <dbl>, variance <dbl>, ci_low <dbl>, ci_high <dbl>

    data_tbl <- tidy_combine_distributions(tn, tb)

    tidy_distribution_summary_tbl(data_tbl)
    #> # A tibble: 1 × 12
    #>   mean_val median_val std_val min_val max_val skewness kurtosis range   iqr
    #>      <dbl>      <dbl>   <dbl>   <dbl>   <dbl>    <dbl>    <dbl> <dbl> <dbl>
    #> 1    0.182      0.330   0.749   -2.71    3.09   -0.732     4.33  5.81 0.693
    #> # ℹ 3 more variables: variance <dbl>, ci_low <dbl>, ci_high <dbl>
    tidy_distribution_summary_tbl(data_tbl, dist_type)
    #> # A tibble: 2 × 13
    #>   dist_type  mean_val median_val std_val min_val max_val skewness kurtosis range
    #>   <fct>         <dbl>      <dbl>   <dbl>   <dbl>   <dbl>    <dbl>    <dbl> <dbl>
    #> 1 Gaussian …   -0.106    -0.0414   0.936 -2.71     3.09    0.0808     3.01 5.81
    #> 2 Beta c(1,…    0.470     0.464    0.287  0.0109   0.997   0.118      1.82 0.986
    #> # ℹ 4 more variables: iqr <dbl>, variance <dbl>, ci_low <dbl>, ci_high <dbl>