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)
baseline=c(140,138,150,148,135)
week2=c(132,135,151,146,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.
##
## Paired t-test
##
## data: baseline and week2
## t = 2.2616, df = 4, p-value = 0.08652
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.7739122 7.5739122
## sample estimates:
## mean of the differences
## 3.4
Alternatively
diff=baseline-week2
t.test(diff)
##
## One Sample t-test
##
## data: diff
## t = 2.2616, df = 4, p-value = 0.08652
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## -0.7739122 7.5739122
## sample estimates:
## mean of x
## 3.4
A sample of 9 men yielded a sample average brain volume of 1,100cc and a standard deviation of 30cc. What is the complete set of values of μ0 that a test of H0:μ=μ0 would fail to reject the null hypothesis in a two sided 5% Students t-test?
avg=1100
std=30
n=9
avg+c(-1,1)*qt(0.975,n-1)*std/3
## [1] 1076.94 1123.06
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.
binom.test(3,4,0.5,alt="greater")
##
## Exact binomial test
##
## data: 3 and 4
## number of successes = 3, number of trials = 4, p-value = 0.3125
## alternative hypothesis: true probability of success is greater than 0.5
## 95 percent confidence interval:
## 0.2486046 1.0000000
## sample estimates:
## probability of success
## 0.75
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?
ppois(10,18,lower.tail=TRUE)
## [1] 0.03036626
Suppose that 18 obese subjects were randomized, 9 each, to a new diet pill and a placebo. Subjects’ body mass indices (BMIs) were measured at a baseline and again after having received the treatment or placebo for four weeks. The average difference from follow-up to the baseline (followup - baseline) was −3 kg/m2 for the treated group and 1 kg/m2 for the placebo group. The corresponding standard deviations of the differences was 1.5 kg/m2 for the treatment group and 1.8 kg/m2 for the placebo group. Does the change in BMI appear to differ between the treated and placebo groups? Assuming normality of the underlying data and a common population variance, give a pvalue for a two sided t test.
avgt=-3
avdp=1
diff=avgt-avdp
stt=1.5
stp=1
n=9
df=2*(n-1)
st2=((n-1)*stt^2+(n-1)*stp^2)/df
fac=(2/n)
sts=sqrt(st2*fac)
t=abs(diff/sts)
2*(1-pt(t,df))
## [1] 5.516554e-06
Brain volumes for 9 men yielded a 90% confidence interval of 1,077 cc to 1,123 cc. Would you reject in a two sided 5% hypothesis test of H0:μ=1,078?
No we would not reject as the value μ=1,078 is contained within the 90% confidence interval which is more restrictive than the 95%
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
delta=0.01
sd=0.04
alpha=0.05
power.t.test(n=n,delta=delta,sd=sd,sig.level= alpha,alt="one.sided",type="one.sample")$power
## [1] 0.7989855
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?
power.t.test(power=0.9,delta=delta,sd=sd,sig.level= alpha,alt="one.sided",type="one.sample")$n
## [1] 138.3856
As you increase the type one error rate, α, what happens to power?
You will get larger power