Unveiling New Tools in the TidyDensity Arsenal: Distribution Parameter Wrangling


Steven P. Sanderson II, MPH


June 4, 2024


Greetings, fellow data enthusiasts! Today, we’re thrilled to unveil a fresh wave of functionalities in the ever-evolving TidyDensity package. Buckle up, as we delve into the realm of distribution statistics!

This update brings a bounty of new functions that streamline the process of extracting key parameters from various probability distributions. These functions adhere to the familiar naming convention util_distribution_name_stats_tbl(), making them easily discoverable within your R workflow.

Let’s meet the newcomers:

  • util_zero_truncated_negative_binomial_stats_tbl(): Uncovers the secrets of the zero-truncated negative binomial distribution.
  • util_zero_truncated_poisson_stats_tbl(): Demystifies the zero-truncated Poisson distribution.
  • util_zero_truncated_geometric_stats_tbl(): Unveils the hidden characteristics of the zero-truncated geometric distribution.
  • util_pareto1_stats_tbl(): Extracts the essence of the Pareto Type I distribution.
  • util_paralogistic_stats_tbl(): Unlocks the mysteries of the paralogistic distribution.
  • util_inverse_weibull_stats_tbl(): Illuminates the parameters of the inverse Weibull distribution.
  • util_inverse_pareto_stats_tbl(): Provides insights into the inverse Pareto distribution.
  • util_inverse_burr_stats_tbl(): Offers a glimpse into the world of the inverse Burr distribution.
  • util_generalized_pareto_stats_tbl(): Simplifies extracting parameters from the generalized Pareto distribution.

Now, you might be wondering, “How do I put these new functions to use?” Fear not, for the answer is as easy as pie!


Let’s explore the zero-truncated binomial distribution. Suppose we’re simulating the number of successes in 10 trials with a success probability of 0.1 (but hey, successes of zero aren’t possible in this scenario!).

library(TidyDensity)  # Assuming you've installed TidyDensity

tidy_zero_truncated_binomial(.size = 10, .prob = 0.1) |>
  util_zero_truncated_binomial_stats_tbl() |>
Rows: 1
Columns: 15
$ tidy_function     <chr> "tidy_zero_truncated_binomial"
$ function_call     <chr> "Zero Truncated Binomial c(10, 0.1)"
$ distribution      <chr> "Zero Truncated Binomial"
$ distribution_type <chr> "discrete"
$ points            <dbl> 50
$ simulations       <dbl> 1
$ mean              <dbl> 1.58
$ mode              <dbl> 1
$ range             <chr> "1 to 4"
$ std_dv            <dbl> 0.8103917
$ coeff_var         <dbl> 0.5129061
$ computed_std_skew <dbl> 1.133051
$ computed_std_kurt <dbl> 3.212143
$ ci_lo             <dbl> 1
$ ci_hi             <dbl> 3

This code snippet generates a dataset of zero-truncated binomial values and then utilizes the util_zero_truncated_binomial_stats_tbl() function to extract a summary table containing key parameters like the mean, variance, and quantiles.

Your Turn to Explore!

We encourage you to jump in and experiment with these new additions. Explore the documentation for each function (accessible through ?util_distribution_name_stats_tbl) to discover their specific functionalities and supported distributions.

With these new tools at your disposal, you’ll be well-equipped to gain deeper insights into your data and unlock the power of various probability distributions in your R adventures!