Sequential importance sampling for multi way contingency table Full disclosure: this is a homework problem. I'm having a really hard time understanding the algorithm for applying SIS to contingency tables or what it even means to do sequential importance sampling in this case.

So first thing. What is this saying? $\mu = \sum_{T \in \Omega}1_{\{p(T)\le p(T_o)\}}p(T)$
As best as I can make out, it means the sum of the probabilities of all tables $\in \Omega$ with probability $\le p(T_o)$.
So then... I need to simulate all possible tables $\in \Omega$ and determine their respective probabilities. I can determine the probability using $p(T)$ provided.
In that case, how does this come into play?

If someone could just really dumb this down for me that'd be awesome.
 A: As another student in Stat 428, I know that this question required a lot of thinking to figure out. Yuguo also went over the basic idea in lecture about a week ago. Basically, 


*

*The expression given below is the p-value for the (fisher) exact test.
$$
p = \sum_{T \in \Omega}\mathbb{1}_{p(T)\leq p(T_0)}P(T) 
$$
where $$\mathbb{1}_{p(T)\leq p(T_0)}$$ is an indicator function that equals 1 if $p(T) \leq p(T_0)$ and $0$ otherwise. Thus, this is the sum of probabilities that any table $T$ in the total set of possible tables that could exist given the row and column totals (which are considered fixed for these problems) is less likely than $T_0$, the observed table. Thus, using the importance sampling mindset, the target distribution $p(T)$ (which is difficult to sample directly) is weighted by a proposal distribution $g(T)$. For question, we have multinomial sampling for the table, meaning $$
p(T) \propto \frac{1}{\prod_{i}\prod_{j}n_{ij}!}
$$.


The exact test requires the use of the multinomial distribution, therefore, we can choose that as a proposal distribution. In Yuguo's notes (and in his paper he cites at the end of the section), he gives a schematic of how to iterate through the cells of a contingency table, starting at the $t_{11}$ position. You start off by sampling the first value randomly on the proposal distribution (hypergeometric), then calculating the importance weight, then calculating the next position $t_{21}$, then calculating the importance weight ... so on and so forth, for each column. The T.A. actually gives code for the second question in the lab notes section on compass, so it's pretty easy to re-tool it to calculate the p-value. I suggest running the example given in the lab, and looking over the R-Code carefully to get a better idea of what is being asked.
Good luck!
