• incanter

# cdf-neg-binomial

## incanter.stats

• (cdf-neg-binomial x & options)
Returns the Negative Binomial cdf 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)

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/Cumulative_distribution_function

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

### Source incanter/stats.clj:1337 top

```(defn cdf-neg-binomial
" Returns the Negative Binomial cdf 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)

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/Cumulative_distribution_function

Example:
(cdf-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)
lower-tail? (if (false? (:lower-tail opts)) false true)
cdf-fx (if lower-tail?
(fn [x1] (Probability/negativeBinomial x1 size prob))
(fn [x1] (Probability/negativeBinomialComplemented x1 size prob)))]
(if (coll? x)
(map cdf-fx x)
(cdf-fx x)))))```
Vars in incanter.stats/cdf-neg-binomial: coll? defn let map
Used in 0 other vars