Q1

The following random sample is drawn from a normal distribution. Estimate the population mean \(\mu\) with a 95% confidence interval.

Sample: 10.2, 9.7, 10.3, 10.5, 10.1, 9.5, 9.8

Q2

We compare two population means by gathering two independent samples, one from each population.

Sample 1: 5.8, 5.6, 5.5, 5.4, 5.9, 5.4, 5.2, 5.3, 5.1, 5.6

Sample 2: 6.1, 6.2, 5.3, 5.7, 5.1, 6.2, 5.9, 5.7

Assuming both distributions are normal, determine a 95% confidence interval for the difference in the population means \(\mu_1 - \mu_2\).

Q3

We want to test whether two population means are equal against the alternative that they are different. Two independent random samples yield these summary statistics:
sample size mean s
1 60 3.12 0.415
2 50 3.33 0.525

Let \(\mu_1\), \(\mu_2\) denote the (theoretical) population means for population 1 and 2, respectively. State the null and alternative hypothesis using symbols \(\mu_1\) and \(\mu_2\), calculate the test statistic, and determine the p-value for the test. Finally, at the 5% significance level, do you have statistically significant evidence that the population means are different?

Q4

In a simple random sample of 50 Linfield students, 34 of them have an iphone, and 16 have a different type of phone. Based on this sample, determine a 99% confidence interval for \(p\), the proportion of all Linfield students who have an iphone.

Solutions

Q1

d <- c(10.2, 9.7, 10.3, 10.5, 10.1, 9.5, 9.8)
n <- length(d)
xbar <- mean(d)
s <- sd(d)
tstar <- qt(.975,n-1)
MOE <- tstar*s/sqrt(n)
xbar + c(-MOE,MOE)
## [1]  9.68328 10.34529

The 95% confidence interval for the population mean based on our sample has \(t^*\) = 2.45, margin of error MOE = 0.33, and the interval is 9.68 to 10.35.

Q2

d1 <- c(5.8, 5.6, 5.5, 5.4, 5.9, 5.4, 5.2, 5.3, 5.1, 5.6)
d2 <- c(6.1, 6.2, 5.3, 5.7, 5.1, 6.2, 5.9, 5.7)
n1 <- length(d1)
x1bar <- mean(d1)
s1 <- sd(d1)
n2 <- length(d2)
x2bar <- mean(d2)
s2 <- sd(d2)
tstar <- qt(.975,min(n1-1,n2-1))
MOE <- tstar*sqrt(s1^2/n1+s2^2/n2)
(x1bar-x2bar)+c(-MOE,MOE)
## [1] -0.68628739  0.09628739

The 95% confidence interval for the difference in population means \(\mu_1 - \mu_2\) is -0.69 to 0.1. Notice that the value 0 lives within our interval, which means the confidence interval doesn’t provide statistically significant evidence that the difference in population means is not 0.

Q3

Here we test \(H_o: \mu_1 - \mu_2 = 0\) vs \(H_a: \mu_1 - \mu_2 \neq 0\) (a two-sided test).

The test statistic is \[t = \frac{3.12 - 3.33}{\sqrt{\frac{0.415^2}{60}+\frac{0.525^2}{50}}}\]

(t = (3.12-3.33)/sqrt(.415^2/60+.525^2/50))
## [1] -2.293621

So \(t\) = -2.29, and we assume this value lives in a \(t\)-distribution with 49 degrees of freedom.

The p-value for the 2-sided test is the area under the \(t_{49}\) curve that is further away from 0 than \(t\). Since \(t\) is negative in this exercise, the p-value will be

2*pt(t,49) # since t is negative
## [1] 0.02614021

Since this p-value is less than \(\alpha = .05\) we have statistically significant evidence here to reject \(H_o\) in favor of the alternative \(H_a\). We conclude their is a difference in the population means.

Remarks:

  • In a two-sided test if your test statistic \(t\) is positive, you can compute the p-value by entering 2*pt(-t,df).
  • In a two-sided test, whether \(t\) is positive or negative, the following code using the absolute value function will always give the p-value: 2*pt(-abs(t),df).

Q4

A confidence interval for a population proportion is given by \[\hat{p}\pm z^* \sqrt{\frac{\hat{p}(1-\hat{p})}{n}}.\] Here are the values we plug in:

  • For 99% confidence, \(z^*\) = qnorm(.995) = 2.576
  • \(n\) = 50
  • \(\hat{p} = 34/50 = .68\).

The 99% Confidence interval is then

phat <- 34/50 
n <- 50
zstar <- qnorm(.995)
MOE <- zstar*sqrt(phat*(1-phat)/n)
phat + c(-MOE,MOE)
## [1] 0.5100733 0.8499267

So we believe with 99% confidence that the proportion of all Linfield students with an iPhone is between 0.51 and 0.85.