toy example contingency table sampling

136 views
Skip to first unread message

Luc Coffeng

unread,
Jul 15, 2014, 11:29:47 AM7/15/14
to stan-...@googlegroups.com
Dear dev team and stan users,

Please see attached a toy example for sampling contingency tables with known row and column margins in Stan. The model requires a prior for the distribution of counts within each row (can be anything as long as it's a simplex). The model produces the estimated probability of observations being in a certain cell of the table. The application of this particular model was to redistribute the prevalence of anemia due to difference causes (the row totals) to three severity levels for which we know the total prevalence in the population (the column totals), and given expert priors about the severity distribution of anemia due to each cause (within row distribution).

Best,

Luc
ct_sampling_toy_stan.r

Bob Carpenter

unread,
Jul 16, 2014, 2:01:27 PM7/16/14
to stan-...@googlegroups.com
Thanks for sharing.

We could use another model of the week for Andrew's blog.
This one's very nicely evaluated and even the code comments
hit just the right level for me (explain the hard to understand
parts, not slavishly documenting each line).

- Bob

P.S. And thanks for all the other great advice for users on the list!
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> <ct_sampling_toy_stan.r>

Luc Coffeng

unread,
Jul 16, 2014, 4:09:18 PM7/16/14
to stan-...@googlegroups.com
No worries, it'd be great if other people can find ways to use it!
Reply all
Reply to author
Forward
0 new messages