1.2.3-SNAPSHOT permalink Arrow_down_16x16

sample-beta

incanter.stats

  • (sample-beta size & options)
Returns a sample of the given size from a Beta distribution.
This is equivalent to R's rbeta function.

Options:
:alpha (default 1)
:beta (default 1)
These default values produce a Uniform distribution.

See also:
pdf-beta and cdf-beta

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

Example:
(sample-beta 1000 :alpha 1 :beta 2)

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

(defn sample-beta
" Returns a sample of the given size from a Beta distribution.
  This is equivalent to R's rbeta function.

  Options:
    :alpha (default 1)
    :beta (default 1)
    These default values produce a Uniform distribution.

  See also:
      pdf-beta and cdf-beta

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

  Example:
      (sample-beta 1000 :alpha 1 :beta 2)
"
([^Integer size & options]
    (let [opts (when options (apply assoc {} options))
          alpha (or (:alpha opts) 1)
          beta (or (:beta opts) 1)]
      (if (= size 1)
        (Beta/staticNextDouble alpha beta)
        (for [_ (range size)] (Beta/staticNextDouble alpha beta))))))
Vars in incanter.stats/sample-beta: = defn for let
Used in 0 other vars

Comments top

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