1.2.3-SNAPSHOT Arrow_down_16x16

sample-inv-wishart

incanter.stats

  • (sample-inv-wishart & options)

Returns a p-by-p symmetric distribution drawn from an inverse-Wishart distribution

Options:
:p (default 2) -- number of dimensions of resulting matrix
:df (default p) -- degree of freedoms (aka n), df <= p
:scale (default (identity-matrix p)) -- positive definite matrix (aka V)

Examples:
(use 'incanter.stats)
(sample-inv-wishart :df 10 :p 4)

;; calculate the mean of 1000 wishart matrices, should equal (mult df scale)
(div (reduce plus (for [_ (range 1000)] (sample-wishart :p 4))) 1000)


References:
http://en.wikipedia.org/wiki/Inverse-Wishart_distribution

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

(defn sample-inv-wishart
"
  Returns a p-by-p symmetric distribution drawn from an inverse-Wishart distribution

  Options:
    :p (default 2) -- number of dimensions of resulting matrix
    :df (default p) -- degree of freedoms (aka n), df <= p
    :scale (default (identity-matrix p)) -- positive definite matrix (aka V)

  Examples:
    (use 'incanter.stats)
    (sample-inv-wishart :df 10  :p 4)

    ;; calculate the mean of 1000 wishart matrices, should equal (mult df scale)
    (div (reduce plus (for [_ (range 1000)] (sample-wishart :p 4))) 1000)


  References:
    http://en.wikipedia.org/wiki/Inverse-Wishart_distribution

"
  ([& options]
    (let [opts (when options (apply assoc {} options))
          scale (or (:scale opts) (when (:p opts) (identity-matrix (:p opts))))
          p (count scale)
          df (or (:df opts) p)]
      (solve (sample-wishart :p p :df df :scale scale)))))
Vars in incanter.stats/sample-inv-wishart: defn let
Used in 0 other vars

Comments top

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