Answer the following:

Question 1: What is the expected number of heads in tossing a coin three times?

a = 3
b = 0.5
c <- a*b
print(c)
## [1] 1.5

Question 2: What is variance number of heads in tossing a coin thrice?

e <- (a*b)*(1-b)
print(e)
## [1] 0.75

Question 3: You flip a fair coin 6 times, what is the probability of getting 5 or 6 heads?

choose(5,6) * .5 ^ 5 + choose(6,6) * .5 ^ 5
## [1] 0.03125

Question 4: Suppose that diastolic blood pressures (DBPs) from men aged 30-44 are normally distributed with a mean of 80mmHg and a standard deviation of 10 mmHg. What is the probability that a random 30-44 year old has a DBP less than 70?

pnorm(70,mean=80,sd= 10,lower.tail=TRUE)
## [1] 0.1586553

Question 5: Brain volume for adult men is normally distributed with a mean of about 1,100 cc with a standard deviation of 80 cc. What brain volume represents the 95th percentile ?

mean <- 1100
sd <- 80
p <- 0.95
qnorm(p,mean,sd)
## [1] 1231.588

Question 6: Refer to Q6, Brain volume for adult men is normally distributed with a mean of about 1,100 cc with a standard deviation of 80 cc. Consider the sample mean of 100 random adult men from this population. What is th 95th percentile of the distribution of the sample mean?

n <- 100
standard_dev <- 80
standard_error <- standard_dev/sqrt(100)
qnorm(.95,standard_error,mean=1100)
## [1] 1113.159

Question 7: In a population of interest, a sample of 12 men yielded a sample average brain volume of 1,100cc and a standard deviation of 30cc. What is a 95% Student’s T confidence interval for the mean brain volume in this new population?

n <- 12
μ <- 1100
σ <- 30
quantile = 0.975
confidenceInterval = μ + c(-1, 1) * qt(quantile, df=n-1) * σ / sqrt(n)
confidenceInterval
## [1] 1080.939 1119.061