Q1

In a population of interest, a sample of 9 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 vol.

mn = 1100
s = 30
n = 9
round(1100 + c(-1,1)*qt(.975, df = 8)*s/sqrt(n))
## [1] 1077 1123

Q2

A diet pill is given to 9 subjects over six weeks. The average difference in weight (follow up - baseline) is -2 pounds. What would the standard deviation of the difference in weight have to be for the upper endpoint of the 95% T confidence interval to touch 0?
- Answer: See Ex5 in t Confidence intervals chapter. It is the paired measurement. Actually we need to solve this equation: \[\bar{y_d} - t_.{975}\frac{1}{\sqrt{n}} = 0\]. In the other word, we just need toi find \(\bar{y_d}\)

n = 9
mn_dif = 2
t = .95
(y_d <- round(mn_dif*sqrt(n) / qt(.975, df = 8), 2))
## [1] 2.6

Q3

In an effort to improve running performance, 5 runners were either given a protein supplement or placebo. Then, after a suitable washout period, they were given the opposite treatment. Their mile times were recorded under both the treatment and placebo, yielding 10 measurements with 2 per subject. The researchers intend to use a T test and interval to investigate the treatment. Should they use a paired or independent group T test and interval?

-A paired interval

-It’s necessary to use both

-Independent groups, since all subjects were seen under both systems

-You could use either

Q4

In a study of emergency room waiting times, investigators consider a new and the standard triage systems. To test the systems, administrators selected 20 nights and randomly assigned the new triage system to be used on 10 nights and the standard system on the remaining 10 nights. They calculated the nightly median waiting time (MWT) to see a physician. The average MWT for the new system was 3 hours with a variance of 0.60 while the average MWT for the old system was 5 hours with a variance of 0.68. Consider the 95% confidence interval estimate for the differences of the mean MWT associated with the new system. Assume a constant variance. What is the interval? Subtract in this order (New System - Old System).

Where the notation \(t_{n_x + n_y - 2, 1 - \alpha/2}\) is a \(t\) quantile with \(n_x + n_y - 2\) degrees of freedom and with the probaility of \(1 - \alpha/2\) and the pooled variance estimator is: \[S_p^2 ={(n_x-1)S_x^2 + (n_y-1)S_y^2}/(n_x + n_y - 2)\]

old.mean <- 5
old.var <- 0.68
old.n <- 10

new.mean <- 3
new.var <- 0.60
new.n <- 10

alpha <- 1 - 0.95

Calculate the \(t\) quantile with \(n_x + n_y - 2\) degree of freedom.

(t <- qt(1 - alpha / 2, old.n + new.n - 2))
## [1] 2.100922

Calculate the standard deviation \(s_p\). Note that \(var = s^2\)

(sp <- sqrt(((old.n - 1) * old.var + (new.n - 1) * new.var) / (old.n + new.n - 2)))
## [1] 0.8

Then the confidence interval for the mean difference between the groups is:

round((new.mean - old.mean) + c(-1, 1) * t * sp * sqrt(1 / old.n + 1 / new.n), 2)
## [1] -2.75 -1.25

Q5

Suppose that you create a 95% T confidence interval. You then create a 90% interval using the same data. What can be said about the 90% interval with respect to the 95% interval?

- The interval will be narrower.

Q6

To further test the hospital triage system, administrators selected 200 nights and randomly assigned a new triage system to be used on 100 nights and a standard system on the remaining 100 nights. They calculated the nightly median waiting time (MWT) to see a physician. The average MWT for the new system was 4 hours with a standard deviation of 0.5 hours while the average MWT for the old system was 6 hours with a standard deviation of 2 hours. Consider the hypothesis of a decrease in the mean MWT associated with the new treatment.

What does the 95% independent group confidence interval with unequal variances suggest vis a vis this hypothesis? (Because there’s so many observations per group, just use the Z quantile instead of the T.)

old.mean <- 6
old.sd <- 2
old.n <- 100

new.mean <- 4
new.sd <- 0.5
new.n <- 100
quant <- 0.975 #  is 95% with on both sides of the range.

Calculate the pooled standard deviation

psd <- sqrt(((old.n - 1)*old.sd^2 + (new.n - 1)*new.sd^2)/(old.n+new.n - 2) )
round(psd,3)
## [1] 1.458

And the confidence intervals is:

confidence_intervals <- old.mean - new.mean + c(-1,1)*qnorm(quant)*psd*(1/old.n + 1/new.n)^(1/2)
round(confidence_intervals, 2)
## [1] 1.6 2.4

So the answer is:
- When subtracting (old - new) the interval is entirely above zero. The new system appears to be effective.

Q7

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 over the four week period appear to differ between the treated and placebo groups? Assuming normality of the underlying data and a common population variance, calculate the relevant 90% t confidence interval. Subtract in the order of (Treated - Placebo) with the smaller (more negative) number first.

quant = 0.95 # is 90% with 5% on both sides of the range

n_y <- 9 # subjects treated
n_x <- 9 # subjects placebo
sd_y <- 1.5# kg/m2 std.dev. treated 
sd_x <- 1.8# kg/m2 std.dev. placebo 
mu_y <- -3#  kg/m2 average difference treated
mu_x <- 1#  kg/m2 average difference placebo

Calculate the pooled standard deviation

psd <- sqrt(((n_x - 1)*sd_x^2 + (n_y - 1)*sd_y^2)/ (n_x + n_y -2))
round(psd,2)
## [1] 1.66

and calculate the confidence intervals

confidence_intervals <- mu_y - mu_x + c(-1,1)* qt(quant, df = n_y + n_x -2)*psd* (1/n_x + 1/n_y) ^.5
round(confidence_intervals,2)
## [1] -5.36 -2.64