If you have the following, how would you calculate the percentages of each.
Say you have 4 chances
75% chance to produce 1
75% chance to produce 1
25% chance to produce 1
25% chance to produce 1
What are the chances for 0,1,2,3,4 and how do you find them?
if anybody is wondering, I'm working an algorithm for genes from only 1 parent and I need to find the chances a parent will pass on said gene.
Edit (by a mathematician) hoping I've helped clarify the question:
I have four independent trials, two with probability of success $0.75$, two with probability $0.25$. What are the probabilities for each possible total number of successes?
The general problem: $n$ trials with success probability $p_k$ on the $k$th trial.
Edit (by OP) I don't know how to explain this so I'll just write it in the code I use. Maybe it will be easier to understand this way.
$x = 0;
if(rand(1,100) >= 75){
$x = $x+1;
}
if(rand(1,100) >= 75){
$x = $x+1;
}
if(rand(1,100) >= 25){
$x = $x+1;
}
if(rand(1,100) >= 25){
$x = $x+1;
}
What is the chance $x will be 0?
What is the chance $x will be 1?
What is the chance $x will be 2?
What is the chance $x will be 3?
What is the chance $x will be 4?
How did you find it?(so that I can figure it out myself for other cases)
Let $X_p$ be the rv which counts the number of successes for the trials which have probability $p$ of success. So $X_p$ can take values in $\{0,1,2\}$ for $p=\frac{1}{4},\frac{3}{4}$.
Then $X_p\sim B(2,p)$ for $p=\frac{1}{4},\frac{3}{4}$. ($X_p$ is binomially distributed with trials: $2$, probability: $p$)
Hence
$$P(X_p=k)={2\choose k}p^k(1-p)^{2-k}$$
for $k\in\{0,1,2\}$.
Finally, we're interested in $X_\frac{1}{4}+X_\frac{3}{4}$ and
$$P\left(X_\frac{1}{4}+X_\frac{3}{4}=k\right)=\sum_{i=0}^k P\left(X_\frac{1}{4}=i\right)P\left(X_\frac{3}{4}=k-i\right)$$
Note that $P\left(X_p=j\right)=0$ for $j\not\in\{0,1,2\}$. Whenever $i,k-i\in\{0,1,2\}$, however, we have
$$P\left(X_\frac{1}{4}=i\right)P\left(X_\frac{3}{4}=k-i\right)={2\choose i}\left(\frac{1}{4}\right)^i\left(\frac{3}{4}\right)^{2-i}\times{2\choose k-i}\left(\frac{3}{4}\right)^{k-i}\left(\frac{1}{4}\right)^{2-k+i}$$
$$={2\choose i}{2\choose k-i}\left(\frac{1}{4}\right)^{2-k+2i}\left(\frac{3}{4}\right)^{2+k-2i}$$
$$={2\choose i}{2\choose k-i}\left(\frac{3^{2+k-2i}}{4^{4}}\right)$$
for $k\in\{0,1,2,3,4\}$.