xronos-ch / xronos.rails

Ruby on Rails application powering XRONOS, an open infrastructure for chronometric data from archaeological contexts worldwide
https://xronos.ch
MIT License
4 stars 0 forks source link

Calculating highest density intervals requires multiple calls to calibrator #329

Open joeroe opened 7 months ago

joeroe commented 7 months ago

Because we only cache the probability distribution, TAQ, and TPQ on cal records for c14 calibrations. I don't want to add HDI to that, because it belongs to specifically to (posterior) radiocarbon distributions, not to probabilistic dates more generally. Also, the choice of threshold is arbitrary and it would be nice to allow the user to select different ones (pending #328).

One solution would be to calculate the HDI in Ruby, perhaps building on https://github.com/joeroe/ruby-radiocarbon/, which would also make some related issues with calibrator go away (#323, #327, https://github.com/xronos-ch/xronos.config/issues/6).

On the other hand, the only actual problem with this—apart from the inelegance—is the possible performance hit, and I'm not sure that's significant. This is Cpp code we're talking about.


Incidentally, I went down a rabbit hole of terminology and algorithms in looking for a solution for this for ruby-radiocarbon. These were particularly useful reading:

As I understand it, what archaeologists refer to as "sigma ranges" are more properly the highest density intervals, regions, or sets.

Sometimes a p for posterior sneaks in there, but I think that's not quite right because they can be extracted from any kind of probability density distribution; p for probability makes more sense, but seems redundant. Some say that an 'interval' should be reserved for a single continuous range, but that seems a bit arbitrary to me, and 'interval' is more intuitive when we're talking about time.

joeroe commented 7 months ago

Actually I can think of some benefit of doing this outside calibrator: