This question has been migrated from the [MSE](https://math.stackexchange.com/questions/4478972/estimating-the-variance-of-monte-carlo-estimators-for-f-z-and-f-z-z-x-y).


**Background/Motivation:**


We have $Z=X/Y$ where $X$ and $Y$ are independent and $X\sim\mathcal N(\mu,\sigma^2)$. The density of $Y$ is not important here. We can write the distribution and density functions of $Z$ in terms of expected values w.r.t. $Y$ as
$$
F\_Z(z)=\mathsf E\Phi\left(\frac{z|Y|-\operatorname{sign}(Y)\mu}{\sigma}\right)
$$
and
$$
f\_Z(z)=\mathsf E\left(\frac{|Y|}{\sigma}\phi\left(\frac{zY-\mu}{\sigma}\right)\right),
$$
where $\Phi(\cdot)$ and $\phi(\cdot)$ represent the standard normal cdf and pdf, respectively. This leads to unbiased Monte Carlo estimators of the distribution and density functions. For example, given a sample $Y\_1,\dots,Y\_n$ we can estimate the distribution function $F\_Z$ at the point $z$ via
$$
\hat F\_Z(z)=\frac{1}{n}\sum\_{k=1}^n\Phi\left(\frac{z|Y\_k|-\operatorname{sign}(Y\_k)\mu}{\sigma}\right)
$$
I am interested in evaluating the variance of these estimators as a function of $z$, i.e. $\mathsf{Var}(\hat F\_Z)(z)$ and $\mathsf{Var}(\hat f\_Z)(z)$.




---


**Approach:**


It turns out in my application $\sigma\ll\mathsf{Var}Y$ so much so that $X$ looks nearly constant in comparison to $Y$. As such, taking limit $\sigma\to 0$ in the above expressions still gives good approximations to the cdf/pdf of $Z$. For example, taking the limit $\sigma\to0$ in the expression for the cdf we make use of the fact that the normal cdf tends to a step function giving the approximation
$$
F\_Z(z)\approx\mathsf E(\mathbf 1\_{z|Y|-\operatorname{sign}(Y)\mu>0}),
$$
and so we have the corresponding MC estimator
$$
\hat F\_Z(z)\approx\frac{1}{n}\sum\_{k=1}^n\mathbf 1\_{z|Y\_k|-\operatorname{sign}(Y\_k)\mu>0}.
$$
This approximation is very convenient because $\mathbf 1\_{z|Y|-\operatorname{sign}(Y)\mu>0}$ is Bernoulli distributed with success probability $p=\mathsf E(\mathbf 1\_{z|Y|-\operatorname{sign}(Y)\mu>0})\approx F\_Z(z)$, that is we have the distributional approximation $\mathbf 1\_{z|Y|-\operatorname{sign}(Y)\mu>0}\sim\operatorname{Binomial}(1,F\_Z(z))$. As such we obtain the approximation
$$
\mathsf{Var}(\hat F\_Z)(z)\approx\frac{F\_Z(z)(1-F\_Z(z))}{n}.
$$
I performed simulations to estimate $\mathsf{Var}(\hat F\_Z)(z)$ and compared the estimates to this approximation which showed excellent agreement. **However, I am unable to see how to extend this idea to estimate $\mathsf{Var}(\hat f\_Z)(z)$.**


Given $Y$ we note that
$$
|Y|\frac{1}{\sigma}\phi\left(\frac{zY-\mu}{\sigma}\right)
=\frac{1}{\sqrt{2\pi}\sigma/|Y|}\exp\left(-\frac{(zY-\mu)^2}{2\sigma^2}\right)
=\frac{1}{\sqrt{2\pi}\sigma/|Y|}\exp\left(-\frac{(z-\mu/Y)^2}{2(\sigma/|Y|)^2}\right),
$$
which is a normal density with mean $\mu/Y$ and variance $(\sigma/|Y|)^2$. So taking the limit $\sigma\to 0$ in the expression for $f\_Z$ gives
$$
f\_Z(z)\approx \mathsf E(\delta(z-\mu/Y))
$$
and the corresponding "estimator"
$$
\hat f\_Z(z)\approx\frac{1}{n}\sum\_{k=1}^n\delta(z-\mu/Y\_k).
$$
But here is where I run into trouble. In calculating the variance $\mathsf{Var}(\hat f\_Z)(z)$ using this approximation we would have to evaluate $\mathsf E\delta^2(z-\mu/Y)$, which I do not know what to do with. How do I proceed? Why did this approach work for approximating $\mathsf{Var}(\hat F\_Z)(z)$ but runs into problems in estimating $\mathsf{Var}(\hat f\_Z)(z)$?



Estimating the variance of Monte Carlo estimators for $F_Z$ and $f_Z$, $Z=X/Y$
$\newcommand{\de}{\delta}\newcommand{\si}{\sigma}$Of course, $\de^2$ makes no sense. So, do not use $\de$.


Instead, write
\begin{equation}
 f\_Z(z)=E g(Y)\approx \hat f\_Z(z):=\frac{1}{n}\sum\_{k=1}^n g(Y\_k),
\end{equation}
where
\begin{equation}
 g(y):=\frac{|y|}\si\,\phi\Big(\frac{zy-\mu}\si\Big). 
\end{equation}
If
\begin{equation}
 \nu:=EY\ne0 \quad\text{and}\quad Var\,Y\ne0 \quad\text{and}\quad g'(\nu)\ne0, 
\end{equation}
then, by the [delta method](https://en.wikipedia.org/wiki/Delta_method#Univariate_delta_method), $\hat f\_Z(z)\approx N(g(\nu),g'(\nu)^2 (Var\,Y)/n)$, in the sense that the distribution of
\begin{equation}
 \frac{\hat f\_Z(z)-g(\nu)}{g'(\nu) \sqrt{(Var\,Y)/n}}
\end{equation}
converges weakly to the standard normal distribution as $n\to\infty$.


So, the asymptotic variance of $\hat f\_Z(z)$ is $g'(\nu)^2 (Var\,Y)/n$. Note also that
\begin{equation}
 g'(\nu)=\frac{\phi(\nu z-\mu ) \left(z | \nu | (\mu -\nu z)+\sigma ^2 \text{sgn}(\nu )\right)}{\sigma ^3}. 
\end{equation}


