1

I am trying to implement a program that samples from two identically distributed Bernoulli random variables, $X_1$ and $X_2$, such that they have a specific correlation coefficient, $\rho$.

I found a post that almost does what I want to do:

https://stats.stackexchange.com/a/318935

However, the parameter $p$ of the Bernoulli distributions is dependent on $\rho$, i.e., I can't leave $p$ fixed and generate samples with a desired $\rho$. In theory, I do not see any reason why this should not be possible.

synack
  • 149
  • 12
  • Because the thread you reference thoroughly answers this question, please provide more explanation of what you are looking for. – whuber Oct 23 '20 at 18:55
  • I'm not sure what is missing in my explanation (last sentence). What is not clear, exactly? I'm looking for generating the samples by choosing both $\rho$ and $p$ not only one or the other. – synack Oct 23 '20 at 19:37
  • Your question has already been completely answered. I can't understand your last paragraph because it's not grammatical: the English syntax doesn't make sense. I am beginning to wonder whether the thread at https://stats.stackexchange.com/questions/284996 might instead be what you're looking for. – whuber Oct 23 '20 at 20:03
  • I fixed the typo in the last sentence. Maybe there's something I'm missing.. isn't it possible to ask for a method to generate samples from two bernoullis for a given $\rho$ and $p$? The answer I linked to in my post and that you say it answers my question doesn't let you do that, it only allows it if either $\rho$ or $p$ is fixed but not for any arbitrary pair... – synack Oct 23 '20 at 20:48
  • $iid$ implies uncorrelated variables, so what do you mean are $iid?$ – Dave Oct 23 '20 at 21:05
  • @Dave: my bad, I meant identically distributed, not iid. It's fixed, thanks! – synack Oct 23 '20 at 21:07
  • You're linking to the wrong thread. See the one I referenced in my previous comment. *It answers your question.* In fact, it goes beyond it by allowing $X_1$ and $X_2$ to be any Binomial variables, not just Binomial$(1,p)$ variables. – whuber Oct 23 '20 at 21:55
  • 1
    Oh, I see what you mean. I think you're right, @whuber, the one you referenced does solve this question. I missed it. Thanks! – synack Oct 23 '20 at 22:12
  • Thank you: that enables us to resolve your question by linking it to an existing answer. This is useful because future users might wind up in the present thread as a result of a search. – whuber Oct 24 '20 at 14:03

0 Answers0