vistributions 0.2.2

R
packages
probability
vistributions 0.2.2 makes the captions, shaded regions and input checks of the distribution plots agree with the exact probabilities.
Author

Aravind Hebbali

Published

November 26, 2026

vistributions 0.2.2

vistributions hex logo next to the tagline Visualize probabilities and percentiles of distributions in R, the line 0.2.2, accuracy and input checks, the package name vistributions and vistributions.rsquaredacademy.com

vistributions draws the probability and percentile questions you ask of the normal, t, chi-square, F and binomial distributions, with the answer printed on the plot.

Version 0.2.2 is a correctness release. What the plot shades and what its caption prints now agree with the exact probability, and inputs that cannot describe an event stop with a clear message. If you use the binomial functions to size an event, read the first section.

Install from CRAN

Code
install.packages("vistributions")

The full list of changes is in the release notes.

Shading follows the event

A trial cohort has 40 users, and about 25% of trial users usually upgrade. How likely is it that exactly 10 of them upgrade?

Code
vdist_binom_prob(n = 40, p = 0.25, s = 10, type = "exact")

Binomial distribution of upgrades out of 40 trial users at a 25% rate, with the bar for exactly 10 upgrades shaded and the caption P(X = 10).

The exact value, from base R:

Code
dbinom(10, size = 40, prob = 0.25)
[1] 0.1443643

The caption and the shaded bar match this value. The change matters most for large n, where bars are grouped. A grouped bar that crossed the cutoff was painted whole: for n = 10000, p = 0.01 and s = 100, the shaded area was 19.26% for an event whose exact probability is 4.01% (release notes). Every event cutoff is now a bar edge, so the shaded bar heights add up to dbinom() or pbinom() for the event.

Inputs that cannot be an event

A count of successes has to lie between 0 and the number of trials. Asking for a negative count used to be accepted, with the caption P(X) <= -1 = 0. It now gives the same clear error as a count above n:

Code
tryCatch(
  vdist_binom_prob(n = 10, p = 0.3, s = -1, type = "lower"),
  error = function(e) conditionMessage(e)
)
[1] "s must be a whole number of successes between 0 and n (n = 10)."

The same release adds checks for the other families, for example whole-number arguments for the binomial and a documented range for percentile probabilities (1e-12 < probs < 1 - 1e-12).

Percentiles under a decimal comma

Delivery times are about 48 hours on average, with a standard deviation of 6 hours. By what time have 95% of orders arrived?

With options(OutDec = ","), which is common in European locales, every percentile and probability export used to fail with NAs introduced by coercion. The decimal mark is now fixed to . wherever numbers are printed and parsed back:

Code
old <- options(OutDec = ",")
vdist_normal_perc(probs = 0.95, mean = 48, sd = 6, type = "lower")

Normal distribution of delivery times with mean 48 hours and standard deviation 6 hours, the lower 95% shaded and the 95th percentile cutoff marked.

Code
options(old)
Code
qnorm(0.95, mean = 48, sd = 6)
[1] 57.86912

Other improvements

  • Continuous percentile probabilities and the normal scale have documented limits, and every limit stops with its own message.
  • Captions print enough digits for the percentage they show, including probabilities below 0.1%.
  • Binomial captions put the inequality inside P(), for example P(X >= 4), and round once from the exact probability.
  • vdist_t_*(), vdist_chisquare_*() and vdist_f_*() no longer truncate non-integer degrees of freedom.
  • Plot grids have a bounded number of points, however large the scale.

The release notes carry the rest.

Documentation

Documentation and examples for every function are at vistributions.rsquaredacademy.com. Report problems at github.com/rsquaredacademy/vistributions/issues.

About the author: Aravind Hebbali runs Rsquared Academy — courses, ebooks, and R packages for learning R and data science.