Is there a bug in calculation of the Beta CDF ?

59 views
Skip to first unread message

Goldritter

unread,
Feb 20, 2017, 5:13:05 AM2/20/17
to Incanter
For a project I needed to visualize different probability density functions and the CDFs.

When I look over the chart for the Beta CDF I saw some discrepancies between the charts on the Incanter page (https://github.com/incanter/incanter/wiki/probability-distributions#beta), the wiki page (https://en.wikipedia.org/wiki/Beta_distribution#/media/File:Beta_distribution_cdf.svg) and my chart. 


I used following code to calculate the y-values:
(defn generate-destribution-data-points [df-fn start end steps]
     
(map #(vector %1 (df-fn %1)) (range start end steps)))


The result of these calculation is a collection of 2D vectors, where the first entry is the x-value and the second the y-value.
If I want, for example, to create the datapoints for a beta distribution with alpha = 5 and beta = 1, I used following call:
(generate-destribution-data-points #(cdf-beta %1 :alpha 5 :beta 1) 0 1 0.01)

I wonder now, if I had done a mistake, which results in the different CDF chart or if there is a bug in the calculation of the beta-CDF in Incanter.

If it helps, here are the dependencies I have in my project:

{:dependencies [[org.clojure/clojure "1.8.0"]
                 
[org.clojure/core.memoize "0.5.8"]
                 
[org.clojure/clojurescript "0.0-3211"]

                 
;; Data Dependencies
                 
[clj-pdf "2.0.0"]
                 
[org.clojure/data.json "0.2.6"]
                 
[org.clojure/data.csv "0.1.2"]
                 
[clojure-csv/clojure-csv "2.0.1"]

                 
[clj-time "0.13.0"]

                 
;; Math dependencies
                 
[org.clojure/math.numeric-tower "0.0.4"]
                 
[org.clojure/data.priority-map "0.0.5"]
                 
[org.clojure/math.combinatorics "0.1.1"]

                 
[incanter/incanter-core "1.9.1"]
                 
[incanter/incanter-charts "1.9.1"]

                 
;; Chart dependencies
                 
[quil "2.3.0"]
                 
[com.google.code.gson/gson "2.5"]
                 
[net.sourceforge.htmlunit/htmlunit "2.19"]
                 
[cheshire "5.3.1"]
                 
[junit/junit "4.12"]

                 
;; DB dependencies
                 
[com.novemberain/monger "3.1.0"]
                 
[korma "0.4.2"]
                 
[org.clojure/java.jdbc "0.3.7"]
                 
[org.postgresql/postgresql "9.3-1100-jdbc41"]


                 
[com.google.guava/guava "19.0"]

                 
[org.clojure/tools.logging "0.2.4"]
                 
[org.slf4j/slf4j-api "1.7.12"]

                 
[pddl-clojure-interface "1.0.4"]


                 
[log4j "1.2.15" :exclusions [javax.mail/mail
                                              javax
.jms/jms
                                              com
.sun.jdmk/jmxtools
                                              com
.sun.jmx/jmxri]]]
}



Reply all
Reply to author
Forward
0 new messages