R software DataVisualizations 1.5.0 adds empirical distribution comparisons
The new ECDFplot function keeps a separate valid count for each group. The release also changes complementary distribution calculations and regional maps.
Compare empirical distributions in one plot
The DataVisualizations package for R reached CRAN in version 1.5.0 on November 28 at 13:50:02 UTC, or 16:50:02 in Istanbul. CRANberries independently tracked the differences from the preceding archive. A new ECDFplot function compares empirical cumulative distributions. It accepts input in forms including vectors, lists, matrices, and data frames. An empirical cumulative distribution gives the fraction of observations at or below a selected value. Steps occur at observed values. Two services with similar average response times can therefore show visible differences in the share of requests served by a particular deadline.
Each curve has a separate denominator
The release notes say that curves are calculated with the finite observations for each series. The function also returns the computed curves and counts of excluded non-finite values. Suppose one service contributed 100 records and the other contributed 40. Removing five and two non-finite values leaves denominators of 95 and 38. A chart can show these two fractions together while the underlying counts remain distinct. Exclusions deserve a separate look when a missing observation may represent a failed measurement. Record the input count, the number retained, and the reason any values were filtered when interpreting the plot.
A change to complementary distribution calculations
The package also fixes CCDFplot for two-column probability density input. In this mode the input supplies positions and densities. The notes specify cumulative trapezoidal integration that returns a complementary value at each position. The code sorts the positions and densities together before integrating. A test can supply positions out of order and check each value in the resulting curve. Empirical curves from raw observations use another input path. When testing the density path, record the units and make sure the x grid and density values remain paired throughout the calculation.
Map and class plot changes
According to the release notes, Choroplethmap and plotChoroplethMap now use sf and ggplot2. A Leaflet representation is available as an option. ClassBarPlot preserves supplied instance names, can use supplied deviations for error bars, and maps colour by class. A report that relies on these displays can use a small input fixture with known regions and class entries. Check that the geometry matches the intended region and that the legend labels correspond to the displayed values. The output of a numeric or spatial join can be tested before rendering the full report.
Check a threshold by hand before using a live dataset
Start with two short series. Include a repeated value in one and a missing entry in the other. Choose a threshold and count the valid observations at or below it in each group. Compare the resulting fractions with the plotted or returned values, and inspect the exclusion count. When two observations share a value, the empirical curve can jump by more than one observation’s share at that position. Save the input, threshold, and package version with the result. The release gives an analyst a way to compare those curves and inspect the data left out by the plotting function.
Archive photo · HilberTraum / Wikimedia Commons ↗ · CC BY-SA 4.0 · An illustrative plot of an empirical cumulative distribution.
Sources and verification
- Primary sourceCRAN ↗
- Technical documentR stats ↗
- Reporting / cross-checkCRANberries ↗
Reader discussion
Which bottleneck would you expect as this solution scales?
No comments yet. Be the first to contribute.
Write a comment