Hi everyone 🙂, how do I get the confidence interval in Clojure. Like with a list of data of orders each week `[40 0 60 30 ...]` which corresponds to each week based on index. I understand for mean, I can just reduce the data to get the sum and divide by number of weeks
fastmath
lib has some functions for that: https://github.com/generateme/fastmath/blob/382ec27d23fbaf8925a088c5d5edc27e4596dd0d/src/fastmath/stats.clj#L407-L442
I, as an exercise, also did a naive implementation of confidence interval here: https://github.com/jumarko/clojure-experiments/blob/master/src/clojure_experiments/stats/confidence_intervals.clj#L69
Bear in mind that I'm a noob in statistics but I hope you find these links useful
Thanks @jumar for mentioning fastmath. There are also other types of intervals (or extents) based on different statistics. In the newest version we have BCa which returns corrected CI for skewed data: https://github.com/generateme/fastmath/blob/4779e6457ba82b5c3ec5f43d9104fc8edebb1b36/src/fastmath/stats.clj#L1065 (thanks to @m.dgrs)