Let $X,Y,Z$ be three discrete random variables which I can numerically sample. I need to numerically estimate the probability that $X=Y$ and the probability that $X=Z$. I would like to know whether the algorithm that I describe below is suited to this goal. In particular, I would like to know whether it is acceptable to use the same samples from $X$ to estimate both quantities.

My current algorithm generates $n$ independent samples of each random variable. That is, I generate three vectors: $$(x_1,\ldots,x_n)\\ (y_1,\ldots,y_n)\\ (z_1,\ldots,z_n)$$ Associated to these vectors, I define two counting variables as follows, $$c_{XY}:=\sum_{i=1}^n\displaystyle\delta_{x_iy_i}\qquad c_{XZ}:=\sum_{i=1}^n\delta_{x_iz_i} $$ where $\delta_{ij}$ is the Kronecker delta. Finally, I estimate my probabilities in the following way: $$P(X=Y)\approx \frac{c_{XY}}{n}\qquad P(X=Z)\approx \frac{c_{XZ}}{n}$$.

I would greatly appreciate any feedback.

New contributor
Adrian Radillo is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
up vote 0 down vote accepted

Your two estimators $c_{XY}/n$ and $c_{XZ}/n$ are unbiased estimators of $P(X=Y)$ and $P(X=Z)$ respectively. They are not independent, however. Whether that is "acceptable" might depend on what you're using them for.

Your Answer

Adrian Radillo is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.