Database Reference
In-Depth Information
4.
We will draw samples for this from the Dirichlet distribution, using
sample-multinomial-params , and put those into a new map associated
with their original key:
(def theta (b/sample-multinomial-params 2000 y))
(def theta-params
(into {}
(map #(vector %1 (i/sel theta :cols %2))
(sort race-keys)
(range))))
5.
We can now summarize these by calling basic statistical functions on the
distributions returned. In this case, we're curious about the distribution of these
summary statistics in the population of which our data is a sample. For example,
in this case, African-Americans are almost 24 percent:
user=> (s/mean (:black theta-params))
0.17924288261591886
user=> (s/sd (:black theta-params))
3.636147768790565E-4
user=> (s/quantile (:black theta-params)
:probs [0.025 0.975])
(0.17853910580802798 0.17995015497863504)
6.
A histogram of the proportions can also be helpful:
(i/view (c/histogram (:black theta-params)))
 
Search WWH ::




Custom Search