data-science

Data science, data analysis, and machine learning in Clojure https://scicloj.github.io/pages/chat_streams/ for additional discussions
zackteo 2021-04-03T06:53:07.023700Z

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

jumar 2021-04-03T07:23:37.023800Z

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

genmeblog 2021-04-03T10:38:33.024200Z

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)

👍 2
zackteo 2021-04-03T12:04:35.024700Z

Thanks @tsulej @jumar! I just went with ci it is good enough for my purposes! Am glad I managed to use clojure for my stochastic modelling assignment :D

👍 1