A pharmatical 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) :
## Warning: package 'knitr' was built under R version 3.3.2
subject | baseline | Week2 |
---|---|---|
1 | 140 | 132 |
2 | 138 | 135 |
3 | 150 | 151 |
4 | 148 | 146 |
5 | 135 | 130 |
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.
Answer : We want to test the hypothesis \({H_0 : \mu_0=0}\) against \({H_a : \mu_0 \neq 0}\), where \({\mu_0}\) is the difference of the means between the baseline and the measures after two weeks.
baseline <- c(140,138,150,148,135)
Week2 <- c(132,135,151,146,130)
t.test(Week2,baseline,alternative="two.sided",paired=TRUE)
##
## Paired t-test
##
## data: Week2 and baseline
## 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
The p-value is 0.087.
A sample of 9 men yielded a sample average brain volume of 1,100cc and standard deviation of 30cc. What is the complete set of values of \({\mu_0}\) that a test of \({H_0 : \mu=\mu_0}\) would fail to reject the null hypothesis in a two-sided 5% Students t-test ?
Answer : We want to determine the 95% confidence interval for this Student’s t-test.
CI <- 1100 + c(-1,1)*qt(0.975,8)*30/sqrt(9)
CI
## [1] 1076.94 1123.06
The complete set of values is 1077 to 1123.
Researchers conducted a blind taste test of Coke versus Pepsi. Each of four people was asked which of two blinded drinks given in random order that they preferred. The data was such that 3 of the 4 people chose Coke. Assuming that this sample is representative, report a P-value for a test of the hypothesis that Coke is preferred to Pepsi using a one-sided exact test.
Answer : Let us call p the proportion of people who prefer Coke than Pepsi. Then we want to test the hypothesis \({H_0 : p=0.5}\) versus \({H_a : p>0.5}\). It can be done usin the khi squared independance test :
chisq.test(c(3,1),p=c(0.5,0.5))
## Warning in chisq.test(c(3, 1), p = c(0.5, 0.5)): Chi-squared approximation
## may be incorrect
##
## Chi-squared test for given probabilities
##
## data: c(3, 1)
## X-squared = 1, df = 1, p-value = 0.3173
So the p-value for a test of the hypothesis that Coke is preferred to Pepsi using a one-sided exact test is 0.31.
Infection rates at a hospital above 1 infection per 100 persons days at risk are believed to be too high ad are used as a benchmark. A hospital that had previously been above the benchmark recently had 10 infections over the last 1787 person days at risk. About what is the one-sided P-value for the relevant test of whether the hospital is “below” the standard ?
Answer : We want to test the hypothesis \({H_0 : \lambda=0.01}\) versus \({H_a : \lambda<0.01}\). We have \({X=10}\), \({t=1787}\) and we assume that \({X_{H_0} \thicksim Poisson(\lambda.t)}\).
lambda <- 0.01
t <- 1787
ppois(10,lambda*t)
## [1] 0.03237153
The one-sided P-value is then 0.03.
Suppose that 18 obese subjects were randomized, 9 each to a new diet pill and a placebo. Subjects’ body mass indice (BMIs) were measured at a baseline and after having received the treatment or placebo for four weeks. The average difference from followup to the baseline (followup - baseline) was \({-3 kg/m^2}\) for the treated group and \({1 kg/m^2}\) for the placebo group. The corresponding standard deviations of the differences was \({1.5 kg/m^2}\) for the treatment group and \({1.8 kg/m^2}\) for the placebo group. Does the change in BMI appear to differ between the treated and the placebo groups ? Assuming normality of the underlying data and a common population variance, give a p-value for a two-sided t-test.
Answer : Let us call \({\mu_{diff,treated}}\) and \({\mu_{diff,placebo}}\) the mean values of the difference (followup-baseline) for the treated group and the placebo group. The hypothesis \({H_0}\) is then :
\[{H_0 : \mu_{diff,treated} = \mu_{diff,placebo}}\]
n_plac <- 9
n_treat <- 9
mudiff_treat <- -3
mudiff_plac <- 1
sddiff_plac <- 1.8
sddiff_treat <- 1.5
s <- sqrt(((n_plac-1)*sddiff_plac^2 + (n_treat-1)*sddiff_treat^2)/(n_plac + n_treat -2))
t <- (mudiff_treat-mudiff_plac)/(s*sqrt(1/n_plac + 1/n_treat))
2*pt(t,n_plac + n_treat-2)
## [1] 0.0001025174
The p-value is less than 0.01.
Brain volumes for 9 men yielded a 90% confidence interval of 1077 cc to 1123 cc. Would you reject in a two sided 5% hypothesis test of \({H_0 : \mu = 1078}\) ?
Answer : The value 1078 is in the 90% confidence interval. As the 95% is wider than the 90% interval, you would not reject.
Researchers would like to conduct a study on 100 healthy adults to detect a four year mean brain volume loss of 0.01 \({mm^3}\). Assume that the standard deviation of four year volume loss in this population is 0.04 \({mm^3}\). About what would be the power of the study for a 5% one sided test versus a null hypothesis of no volume loss ?
Answer :
Let us call \({\mu_{diff}}\) the mean of the difference of loss (Four weeks - baseline). Then we want to test \({H_0 : {\mu_{diff}} = 0}\) versus \({H_a : {\mu_{diff}} < 0}\).
The test statistic is \({t = \frac{\bar{X}}{\sigma}.\sqrt{n}}\). The hypothesis is rejected if \({t > Z_{0.95} = 1.645}\).
\({P \lgroup t > 1.645 \bracevert \mu_{diff}=0.01 \rgroup}\) = \({P \lgroup \frac{\bar{X}-0.01}{\sigma}.\sqrt{n} > 1.645-\frac{0.01}{\sigma}.\sqrt{n} \bracevert \mu_{diff}=0.01 \rgroup}\) = \({P \lgroup Z > -0.855\rgroup}\) = 0.80.
Researchers would like to conduct a study of \({n}\) healthy adults to detect a four year mean brain loss of 0.1\({mm^3}\). Assume that the standard deviation of four year voumle loss is 0.4\({mm^3}\). About what would be the value of \({n}\) needed for 90% power of type one error rate of 5% one-sided test versus a numm hypothesis of no volume loss ?
Answer : We want to test the null hypothesis \({H_0 : \mu_{diff}=0}\) against \({H_a : \mu_{diff} \neq 0}\), where \({\mu_{diff}}\) is the brain volume loss.
From the previous question, we want to have
\({P \lgroup Z > 1.645 - \frac{\sqrt{n}}{4} \rgroup = 0.90}\),i.e.
\({1.645- \frac{\sqrt{n}}{4} > Z_{0.1} = -1.282}\)
So \({n = (4(1.645 + 1.282))^2 = 137.07}\)
So the right answer is n=140.
As yu increase the type of error rate, \({\alpha}\), what happens to the power ? * It’s impossible to tell given the information in the problem * You will get a larger power * You will get a smaller power * No, for real, where does Brian come up with these problems ?
Answer : When \({\alpha}\) increases, you get less evidence to reject, so the power increases.