1.2.3-SNAPSHOT permalink Arrow_down_16x16

pdf-neg-binomial

incanter.stats

  • (pdf-neg-binomial x & options)
Returns the Negative Binomial pdf of the given value of x. It will return a sequence
of values, if x is a sequence. Same as R's dnbinom

Options:
:size (default 10)
:prob (default 1/2)

See also:
cdf-neg-binomial and sample-neg-binomial

References:
http://incanter.org/docs/parallelcolt/api/cern/jet/random/tdouble/NegativeBinomial.html
http://en.wikipedia.org/wiki/Negative_binomial_distribution
http://en.wikipedia.org/wiki/Probability_density_function

Example:
(pdf-neg-binomial 10 :prob 1/2 :size 20)

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source incanter/stats.clj:1306 top

(defn pdf-neg-binomial
" Returns the Negative Binomial pdf of the given value of x. It will return a sequence
  of values, if x is a sequence. Same as R's dnbinom

  Options:
    :size (default 10)
    :prob (default 1/2)

  See also:
      cdf-neg-binomial and sample-neg-binomial

  References:
      http://incanter.org/docs/parallelcolt/api/cern/jet/random/tdouble/NegativeBinomial.html
      http://en.wikipedia.org/wiki/Negative_binomial_distribution
      http://en.wikipedia.org/wiki/Probability_density_function

  Example:
      (pdf-neg-binomial 10 :prob 1/2 :size 20)
"
  ([x & options]
    (let [opts (when options (apply assoc {} options))
          size (or (:size opts) 10)
          prob (or (:prob opts) 1/2)
          dist (NegativeBinomial. size prob (DoubleMersenneTwister.))]
      (if (coll? x)
        (map #(.pdf dist %) x)
        (.pdf dist x)))))
Vars in incanter.stats/pdf-neg-binomial: coll? defn let map
Used in 0 other vars

Comments top

No comments for pdf-neg-binomial. Log in to add a comment.