# How can I use importance sampling to estimate $p$? [duplicate]

I have two density functions, $f$ and $g$. I generated a sample $X_1,\ldots, X_n$ using the distribution corresponding to density function $f$. I'm interested in the parameter $p_g = \operatorname{P}_g(Y_i > c)$, where $Y_i$ is a value drawn from the distribution corresponding to the density function $g$.

Question: How can I use importance sampling to estimate the parameter $p_g$?

I know how to estimate the parameter $p_f = P_f(X_i>c)$; I can just evaluate $$\tilde{p}_f = \dfrac{1}{n}\sum\limits_{i = 1}^n\mathbb{1}_{X_i>c}$$ However, if I want to estimate $p_g$ with importance sampling I would need to compute $$\tilde{p}_g = \dfrac{1}{n}\sum\limits_{i = 1}^n\mathbb{1}_{X_i >c}w(X_i)$$ where $w(X_i)$ is the importance weight. My problem is that I don't know what $w(X_i)$ has to look like in this case. When estimating the mean of the distribution corresponding to $g$ you would just evaluate $$\dfrac{1}{n}\sum\limits_{i =1}^n X_i \dfrac{p(X_i)}{q(X_i)}$$ but I can't see how this translates into what I want..

• $Y_i=\mathbb{I}_{X_i>c}$ is another random variable and a transform of $X_i$. As I replied to the other question you posted on CV at about the same time, you do not need the density of $Y_i$ to compute the IS estimate. – Xi'an Apr 10 '18 at 6:30