1.2.3-SNAPSHOT Arrow_down_16x16

cdf-gamma

incanter.stats

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

Options:
:shape (default 1)
:rate (default 1)
:lower-tail (default true)

See also:
pdf-gamma and sample-gamma

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

Example:
(cdf-gamma 10 :shape 1 :rate 2)
(cdf-gamma 3 :shape 1 :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:575 top

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

  Options:
    :shape (default 1)
    :rate (default 1)
    :lower-tail (default true)

  See also:
      pdf-gamma and sample-gamma

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

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

Comments top

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