1
$\begingroup$

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.

$\endgroup$
9
  • $\begingroup$ Because the thread you reference thoroughly answers this question, please provide more explanation of what you are looking for. $\endgroup$
    – whuber
    Oct 23, 2020 at 18:55
  • $\begingroup$ 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. $\endgroup$
    – synack
    Oct 23, 2020 at 19:37
  • $\begingroup$ 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 stats.stackexchange.com/questions/284996 might instead be what you're looking for. $\endgroup$
    – whuber
    Oct 23, 2020 at 20:03
  • $\begingroup$ 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... $\endgroup$
    – synack
    Oct 23, 2020 at 20:48
  • 1
    $\begingroup$ Oh, I see what you mean. I think you're right, @whuber, the one you referenced does solve this question. I missed it. Thanks! $\endgroup$
    – synack
    Oct 23, 2020 at 22:12

0