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 volume in this new population?

mean1<- 1100
sd1<- 30
n1<- 9
quantile<- 0.975 #is 95% with 2.5% on both sides of the range
mean1+c(-1,1)*qt(quantile,n1-1)*sd1/sqrt(n1)
## [1] 1076.94 1123.06

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?

n2<- 9
mean2<- -2
sd2<- 2*sqrt(n2)/qt(0.975,n2-1) #is 95% with 2.5% on both sides of the range
sd2
## [1] 2.601903

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).

Independent group T intervals

A (1???a)??100 confidence interval for ??y?????x is

Y?????X????tnx+ny???2,1?????/2Sp(1nx+1ny)1/2

The pooled variance estimator is:

S2p={(nx???1)S2x+(ny???1)S2y}/(nx+ny???2)

Rewritten for available variables:

Sp={(nx???1)varx+(ny???1)vary}/(nx+ny???2)????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

quantile<- 0.975 
# is 95% with 2.5% on both sides of the range
n_y <- 10 # nights new system
n_x <- 10 # nights old system
var_y <- 0.60 # variance new (sqrt of ??)
var_x <- 0.68 # variance old (sqrt of ??)
mean_y <- 3# average hours new system
mean_x <- 5# average hours old system
# calculate pooled standard deviation
mean_p <- sqrt(((n_x - 1) * var_x + (n_y - 1) * var_y)/(n_x + n_y - 2))
confidenceInterval <- mean_y - mean_x + c(-1, 1) * qt(quantile, df=n_y+n_x-2) * mean_p * (1 / n_x + 1 / n_y)^.5
round(confidenceInterval,2)
## [1] -2.75 -1.25

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.

quantile=0.95 #is 90% with 5% on both side of the range
n_new<- 9
n_old<- 9
mean_new<- -3
mean_old<- 1
sd_new<- 1.5
var_new<- sd_new^2
sd_old<- 1.8
var_old<- sd_old^2
mean_p <- sqrt(((n_old - 1) * var_old + (n_new - 1) * var_new)/(n_old + n_new - 2))
confidenceInterval <- mean_new - mean_old + c(-1, 1) * qt(quantile, df=n_new+n_old-2) * mean_p * (1 / n_old + 1 / n_new)^.5
round(confidenceInterval,3)
## [1] -5.364 -2.636