1.

A pharmaceutical company is interested in testing a potential blood pressure lowering medication. Their first examination considers only subjects that received the medication at baseline then two weeks later. The data are as follows (SBP in mmHg)

Consider testing the hypothesis that there was a mean reduction in blood pressure? Give the P-value for the associated two sided T test. (Hint, consider that the observations are paired.)

bl <- c(140, 138, 150, 148, 135)
fu <- c(132, 135, 151, 146, 130)
x <- fu-bl
mean(x)
## [1] -3.4
sd(x)
## [1] 3.361547
pt((mean(x)-0)/sd(x)*sqrt(5),df=4)*2
## [1] 0.08652278
t.test(fu, bl, alternative = "two.sided", paired = TRUE)
## 
##  Paired t-test
## 
## data:  fu and bl
## t = -2.2616, df = 4, p-value = 0.08652
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -7.5739122  0.7739122
## sample estimates:
## mean of the differences 
##                    -3.4

4.

Infection rates at a hospital above 1 infection per 100 person days at risk are believed to be too high and are used as a benchmark. A hospital that had previously been above the benchmark recently had 10 infections over the last 1,787 person days at risk. About what is the one sided P-value for the relevant test of whether the hospital is below the standard?

This hospital had previously been above the benchmark, so we want to test the rate is lower than 0.01 or not. So assume the real rate is 0.01, calculate the probability of getting a 10 or less than 10. This probability is less than 0.05, so the H0 is rejected when alpha=0.05.

ppois(10, lambda = 0.01 * 1787)
## [1] 0.03237153

7.

Researchers would like to conduct a study of 100 healthy adults to detect a four year mean brain volume loss of .01 mm3. Assume that the standard deviation of four year volume loss in this population is .04 mm3. About what would be the power of the study for a 5% one sided test versus a null hypothesis of no volume loss?

n <- 100
mua <- 0.01
sd0 <- 0.04
threshold <- qnorm(0.95)*0.04/sqrt(n) +0
1 - pnorm((threshold-mua)/sd0*sqrt(n))
## [1] 0.8037649
1 - pnorm(threshold, mean=mua, sd=sd0/sqrt(n))
## [1] 0.8037649

8.

Researchers would like to conduct a study of n healthy adults to detect a four year mean brain volume loss of .01 mm3. Assume that the standard deviation of four year volume loss in this population is .04 mm3. About what would be the value of n needed for 90% power of type one error rate of 5% one sided test versus a null hypothesis of no volume loss?

threshold = qnorm(0.95)0.04/sqrt(n) (threshold -0.01)/0.04sqrt(n) = qnorm(0.1)

((qnorm(0.95)-qnorm(0.1))*0.04*100)^2
## [1] 137.0216
power.t.test(power=0.9, delta=0.01, sd=0.04, type="one.sample", alt="one.sided")$n
## [1] 138.3856