Rdistance v4.4.0 on CRAN now

Enhancements to distance analysis package Rdistance are on CRAN

R
Distance Analysis
Author

Trent McDonald

Published

April 22, 2026

Modified

April 29, 2026

A new version of Rdistance, version 4.4.0, is on CRAN now. Since I last blogged on Rdistance (May 2025), many updates, bug fixes, and enhancements have taken place. This blog post summarises the changes between Rdistance version 4.0.3 and 4.4.0.


Functionality Changes

  • Added the triangle distance function, a mixture of triangle and uniform distributions. See help(triangle.like) examples.
  • Added the huber distance function, a mixture of an inverted version of Huber loss and a uniform distribution. See help(huber.like) for examples, and the Huber Distance Functions tutorial for more information.
  • Added the oneStep distance function, a mixture of non-overlapping uniform densities. This required inclusion of a new gradient-free optimizer because the oneStep likelihood is not smooth.
  • Implemented use of stats::optim for optimization. This change allows Rdistance to use the gradient-free Nelder-Mead optimizer to maximize certain non-smooth likelihoods (i.e., oneStep, triangle, and huber)
  • Version 4.3.0 added parallel bootstrap processing for confidence interval estimation. Bootstrap resampling to compute confidence intervals can take considerable time and running in parallel, on multiple CPU cores, speeds things up. Parallel processing is handled by multidplyr. Default is to run bootstraps in parallel on n-1 CPU cores, where n is the number of cores available on the local machine . No progress bar is produced during parallel processing. Disable parallel processing by setting parallel = FALSE in call to abundEstim. Run on a specific number of cores by setting parallel to that number (e.g., parallel = 3 uses three cores). I have one report from a user that parallel = TRUE will not work on some versions of maxOS due to issues with multidplyr.
  • Added the Gamma likelihood back into the suite of likelihoods available in Rdistance. The Gamma was removed during the big re-vamp of version 4.0.3. The Gamma likelihood works for both lines and points. It works with both covariates and expansions.
  • Implemented reporting of bootstrap coefficient standard errors, after bootstrap resampling is complete. Prior to bootstrapping, asymptotic se’s are reported when known. After bootstrapping, default standard errors come from the bootstap samples.
  • Included unit assignment helpers. Units can now be assigned with the %#% operator (e.g., 3 %#% “m”), which makes unit assignment easier than in prior versions (which used units::set_units). Fixed unit assignment operators are included for all popular linear and squared units (e.g., 3 %m%. assigns meters to 3). See help(unitHelpers).
  • Included b-spline expansion factors for distance functions. Expansion factors are now cosine, hermite, simple, and bspline.
  • Added verbosity control. Verbosity prints intermediate parameter estimates and likelihoods during maximization. Set options(Rdistance_verbocity = 1) or higher to see progressively more detailed intermediate output. The highest verbosity level, options(Rdistance_verbocity = 5), pauses each iteration for user inspection.
  • Implemented exact likelihood integration when known to significantly decrease computation time. All likelihoods for both lines and points that do not contain expansions use exact integration, which is much quicker than numerical integration. Numeric integration is used only when necessary (because I couldn’t work out the integral).

Documentation Changes

Are too numerous to list. My hope is that the documentation becomes more clear with every version.

I moved all the Rdistance examples and vignettes to a set of tutorials on the McDonald Data Science website. I have more control over examples there, they are indexed by date and keyword, and they look better.

Bug Fixes

  • Version 4.3.0 contained a major bug. That version (in the wild for about a week in February 2026), incorrectly reported ESW when scaling factors (g.x.scl) were less than 1.0. Versions <=4.1.0 reported correct ESW, and ESW reported by 4.3.0 was correct when g.x.scl equaled 1.0 (the default). Version 4.3.1 corrected this bug.
  • Several other non-critical bugs have been corrected.
  • The default value for w.lo was changed in parseModel to suppress warning about x.scl < w.lo (not really a bug, just annoying).