I answered the question regarding the creation of samples with positive support and the known value and variance using gamma distribution in NumPy . I thought I would try the same at Incanter . But unlike the results that I got with NumPy , I could not get a sample mean and variance close to the average of the distribution and variance.
(defproject incanter-repl "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]
[incanter "1.5.4"]])
(require '[incanter
[core]
[distributions :refer [gamma-distribution mean variance draw]]
[stats :as stats]])
(def dist
(let [mean 0.71
variance 2.89
theta (/ variance mean)
k (/ mean theta) ]
(gamma-distribution k theta)))
Incanter calculates the mean and variance of the distribution
(mean dist) ;=> 0.71
(variance dist) ;=> 2.89
I calculate the sample mean and variance based on none of this distribution
(def samples (repeatedly 10000
(stats/mean samples) ;=> 0.04595208774029654
(stats/variance samples) ;=> 0.01223348345651905
, , , . ?
Incanter , Parallel Colt. Parallel Colt. . https://github.com/incanter/incanter/issues/245.