##Part 1 Sarah is about to become an older sister. She is interested in finding out the chances that her new sibling will look like her. Specifically, she is interested in understanding the chances of her sibling being right-handed like her. Right handedness is a dominant gene. Sarah wants to find the probability that her sibling is born with this dominant trait. In order for a child to be born with a dominant trait, either the mother’s or the father’s dominant gene must be passed on to him/her. Based on family history, Sarah’s family doctor tells her that her mother has the dominant trait with a probability of .6 and that her father has the dominant trait with probability .8. The probability of both of them having it is .5.
Sarah wants to know the following: What is the probability that the mom and dad dominant trait prevails and the child also gets the dominant trait?
Sample Space = {[MD/FD], [MD/FR], [MR/FD], [MR/FR]}
Idea: 2 bags, pennies, and nickles. We represent the mom’s chance of the dominant gene being passed on with bag 1. The dominant gene can be represented by 6 pennies and the recessive gene can be represented by 4 nickles. We represent the dad’s chance with bag 2. The dominant gene can be represented by 8 pennies and the recessive gene can be represented by 2 nickles. We would randomly pick a coin from both bags to represent the selection of the “gene”. If a penny is chosen at all, then the child will be right-handed but if two nickles are chosen, then the child will not be right-handed. Replace the coins picked at the end of each simulation.
##Part 2
These are some R basics.
x1 = 205
x2 <- 304
Vector is next!
mydata = c(3, 5, 1.2, 5.1, 7.6, 2)
Call up the variables and the vectors.
x1
## [1] 205
x2
## [1] 304
mydata
## [1] 3.0 5.0 1.2 5.1 7.6 2.0
Let’s do some computations.
summary(mydata)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.200 2.250 4.000 3.983 5.075 7.600
xdata = c()
for (i in 1:10000)
{
mom = rbinom(1, 1, .6)
dad = rbinom(1, 1, .8)
if (mom==1 & dad==1){xdata=c(xdata, "bothdom")}
if (mom==1 & dad==0){xdata=c(xdata, "momdom")}
if (mom==0 & dad==1){xdata=c(xdata, "daddom")}
if (mom==0 & dad==0){xdata=c(xdata, "bothrec")}
}
xdata[1:10]
## [1] "bothdom" "bothrec" "momdom" "bothrec" "bothdom" "bothdom" "daddom"
## [8] "bothdom" "daddom" "bothdom"
length(which(xdata == "bothdom"))
## [1] 4818
length(which(xdata == "momdom"))
## [1] 1216
length(which(xdata == "daddom"))
## [1] 3144
length(which(xdata == "bothrec"))
## [1] 822
Pdom = (length(which(xdata == "bothdom")) + length(which(xdata == "momdom")) + length(which(xdata == "daddom"))) / 10000
Pdom
## [1] 0.9178
Therefore Pdom gives the probability of the child getting the dominant trait based on these parents.
P(A or B) = P(A) + P(B) - P(A & B) = 0.6 + 0.8 - 0.5 = 0.9
20 Trial Simulation: 1. daddom 2. daddom 3. bothdom 4. momdom 5. bothdom 6. bothdom 7. bothdom 8. bothdom 9. daddom 10. daddom 11. daddom 12. daddom 13. bothdom 14. bothdom 15. bothrec 16. bothdom 17. bothdom 18. daddom 19. daddom 20. bothdom