Fork me on GitHub
#data-science
<
2021-04-03
>
zackteo06:04:07

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

jumar07:04:37

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

genmeblog10:04:33

Thanks @U06BE1L6T 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 @U01HZPM4P5X)

👍 6
zackteo12:04:35

Thanks @U1EP3BZ3Q @U06BE1L6T! 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

👍 3