Any idea of how to perform chi-square test for contingency table?

303 views
Skip to first unread message

Kel

unread,
Apr 30, 2014, 2:11:28 AM4/30/14
to


Hello stan users,

I just got to start learning stan recently and I'm just wondering if there is a way to do simple task such as chi-square test for 2x2 contingency table in Stan. In R, it's is fairly easy and straightforward because we can call the function Crosstable and  chisq.test() for analyzing contingency table. However, I'm not quite certain what parameters I should estimate and which statistical modeling I will need to use in Stan. What I do want to know from the parameter estimates is that whether or not, say categorical variable X is independent of another category Y.

Thanks.

Example:


Bob Carpenter

unread,
Apr 30, 2014, 2:31:22 PM4/30/14
to stan-...@googlegroups.com
Stan isn't set up to do this kind of hypothesis testing.

Having said that, you can set up Bayesian equivalents easily
enough. But you need to think of it in terms of a model and
the kind of posterior inference you want to do. See:

http://andrewgelman.com/2009/10/13/what_is_the_bay/

and in case you miss the background:

http://andrewgelman.com/2009/05/15/i_hate_the_so-c/

- Bob
> -Charlie
>
>
>
> --
> 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.

Charles

unread,
May 1, 2014, 11:06:52 PM5/1/14
to stan-...@googlegroups.com
Thanks for the link, Bob!
Reply all
Reply to author
Forward
0 new messages