1.2.3-SNAPSHOT Arrow_down_16x16

cdf-beta

incanter.stats

  • (cdf-beta x & options)
Returns the Beta cdf of the given value of x. It will return a sequence
of values, if x is a sequence. This is equivalent to R's pbeta function.

Options:
:alpha (default 1)
:beta (default 1)
:lower-tail (default true)

See also:
pdf-beta and sample-beta

References:
http://incanter.org/docs/parallelcolt/api/cern/jet/random/tdouble/Beta.html
http://en.wikipedia.org/wiki/Beta_distribution
http://en.wikipedia.org/wiki/Cumulative_distribution_function

Example:
(cdf-beta 0.5 :alpha 1 :beta 2)
(cdf-beta 0.5 :alpha 1 :beta 2 :lower-tail false)

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:476 top

(defn cdf-beta
" Returns the Beta cdf of the given value of x. It will return a sequence
  of values, if x is a sequence. This is equivalent to R's pbeta function.

  Options:
    :alpha (default 1)
    :beta (default 1)
    :lower-tail (default true)

  See also:
      pdf-beta and sample-beta

  References:
      http://incanter.org/docs/parallelcolt/api/cern/jet/random/tdouble/Beta.html
      http://en.wikipedia.org/wiki/Beta_distribution
      http://en.wikipedia.org/wiki/Cumulative_distribution_function

  Example:
      (cdf-beta 0.5 :alpha 1 :beta 2)
      (cdf-beta 0.5 :alpha 1 :beta 2 :lower-tail false)
"
  ([x & options]
    (let [opts (when options (apply assoc {} options))
          alpha (or (:alpha opts) 1)
          beta (or (:beta opts) 1)
          lower-tail? (if (false? (:lower-tail opts)) false true)
          cdf-fx (if lower-tail?
                  (fn [x1] (Probability/beta alpha beta x1))
                  (fn [x1] (- 1 (Probability/betaComplemented alpha beta x1))))]
      (if (coll? x)
        (map cdf-fx x)
        (cdf-fx x)))))
Vars in incanter.stats/cdf-beta: coll? defn let map
Used in 0 other vars

Comments top

No comments for cdf-beta. Log in to add a comment.