1.2.3-SNAPSHOT permalink Arrow_down_16x16

sample-poisson

incanter.stats

  • (sample-poisson size & options)
Returns a sample of the given size from a Poisson distribution.
Same as R's rpois

Options:
:lambda (default 1)

See also:
pdf-poisson and cdf-poisson

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

Example:
(sample-poisson 1000 :lambda 10)

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

(defn sample-poisson
" Returns a sample of the given size from a Poisson distribution.
  Same as R's rpois

  Options:
    :lambda (default 1)

  See also:
      pdf-poisson and cdf-poisson

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

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

Comments top

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