Statistical Reference Quiz 1

1. Consider influenza epidemics for two parent heterosexual families. Suppose that the probability is 17% that at least one of the parents has contracted the disease. The probability that the father has contracted influenza is 12% while the probability that both the mother and father have contracted the disease is 6%. What is the probability that the mother has contracted influenza?

# A=Mother, B = Father
# P(AuB)=17%, P(B)=12%, P(AnB)=6%. 
# Since we know P(AuB)=P(A)+P(B)-P(AnB), therefore P(A)=P(AuB)-P(B)+P(AnB)
P_AuB <- 0.17
P_B <- 0.12
P_AnB <- 0.06

P_A <- P_AuB - P_B + P_AnB
P_A
## [1] 0.11

2. A random variable, X is uniform, a box from 0 to 1 of height 1. (So that its density is f(x)=1 for 0<=x<=1.) What is its 75th percentile?

# This density looks like a box. The point so that the area below it is 0.75 is 0.75. 
qunif(0.75)
## [1] 0.75

3. You are playing a game with a friend where you flip a coin and if it comes up heads you give her X dollars and if it comes up tails she gives you Y dollars. The probability that the coin is heads is p (some number between 0 and 1.) What has to be true about X and Y to make so that both of your expected total earnings is 0. The game would then be called “fair”.

# p/(1-p)=Y/X

4. A density that looks like a normal density (but may or may not be exactly normal) is exactly symmetric about zero. (Symmetric means if you flip it around zero it looks the same.) What is its median?

The median must be 0 since 50 percent of the mass is below 0 and 50% is above

5. Consider the following PMF shown below in R

x <- 1:4
p <- x/sum(x)
temp <- rbind(x, p)
rownames(temp) <- c("X", "Prob")
temp
##      [,1] [,2] [,3] [,4]
## X     1.0  2.0  3.0  4.0
## Prob  0.1  0.2  0.3  0.4
mean <- sum(x*p)
mean
## [1] 3

6. A web site for home pregnancy tests cites the following: When the subjects using the test were women who collected and tested their own samples, the overall sensitivity was 75%. Specificity was also low, in the range 52% to 75%. Assume the lower value for the specificity. Suppose a subject has a positive test and that 30% of women taking pregnancy tests are actually pregnant. What number is closest to the probability of pregnancy given the positive test?

Bayes’ rule states that: P(A|B) = P(B|A)*P(A) / P(B)

P(+|Preg) = 0.75
P(+|NotPreg) = 1 - 0.52 = 0.48
P(Preg) = 0.3
P(NotPreg) = 1- 0.3 = 0.7

The unconditional probability of being found positive P(+)
P(+) = P(+|Preg) x P(Preg) + P(+|NotPreg) x P(NotPreg) = 0.75 x 0.3 + 0.48 x 0.7 = 0.561

P(Preg|+) = P(+|Preg) x P(Preg) / P(+|Preg) = 0.75 x 0.3 / 0.561 = 0.40