Math 132B

Class 18

Procedure for Confidence Intervals

  • Choose your confidence level \(L\) (e.g. 95%).
  • Choose whether you want two-sided (default) or one-sided interval.
  • Choose sample size \(n\).
  • Collect your data.
  • Verify assumptions!!!!
  • From the data, calculate the point estimate \(\bar{x}\) and the sample standard deviation \(s\).
  • Calculate the standard error \(SE = \frac{s}{\sqrt{n}}\)
  • Find the critical \(t\)-score \(t^\star\).
  • Calculate the margin of error \(m = t^\star * SE\).
  • Calculate the bound(s) of the interval.
  • Write down the conclusion.

Confidence Level vs. Margin of Error

  • Confidence level determines the accuracy of the method. This tells you how likely your interval is to “hit the target”.

  • Margin of error tells you how precise your estimate is. This tells you how precisely is the target determined when you hit it.

  • If you want to increase the accuracy, you have to decrease the precision, and vice versa.

  • You can increase one without sacrificing the other by increasing the sample size.

Procedure for Hypotheses Testing

  • Choose your significance level \(\alpha\) (e.g. 5%).
  • Choose whether you want two-sided (default) or one-sided test.
  • Formulate your \(H_0: \mu = \mu_0\) and \(H_A\).
  • Choose sample size \(n\).
  • Collect your data.
  • Verify assumptions!!!!
  • From the data, calculate the point estimate \(\bar{x}\) and the sample standard deviation \(s\).
  • Calculate the standard error \(SE = \frac{s}{\sqrt{n}}\).
  • Calculate the test statistic \(t = \frac{\bar{x} - \mu_0}{SE}\).
  • Determine the \(p\)-value.
  • Compare the \(p\)-value with the significance level \(\alpha\).
  • Write down the conclusion.

Types of Errors

\(H_0\) “true” \(H_0\) false
reject \(H_0\) type I error desired
don’t reject \(H_0\) desired type II error
  • In theory, the significance level \(\alpha\) is the probability of type I error.
  • Choosing smaller \(\alpha\) makes it harder to reject \(H_0\):
    • decreasing the probability of type I error
    • increasing the probability of type II error
  • Similarly, larger \(\alpha\) makes it easier to reject \(H_0\):
    • increasing the probability of type I error
    • decreasing the probability of type II error
  • We can decrease the probability of type II error without changing \(\alpha\), by increasing the sample size.

Example

Researchers collected measurements of 64 zebra mussels (Dreissena polymorpha) from a lake in northern Michigan. The mean length of mussels in their sample was 37.5 mm, with standard deviation 7.2 mm. Use this data to find a 95% confidence interval estimating the mean length of the zebra mussels in the lake.

  • \(\overline{x} = 37.5\) mm

  • \(s = 7.2\) mm

  • \(n = 64\)

  • \(L = 0.95\) so \(\alpha = 0.05\)

  • Two-sided \(t^\star\):

    qt(0.975, df = 63)
    [1] 1.998341
  • \(\displaystyle SE = \frac{s}{\sqrt{n}} = \frac{7.2}{8} = 0.9\)
  • \(m = t^\star\cdot SE = 1.998\cdot 0.9 = 1.7982\)

  • \(\left(\overline{x} - m, \overline{x} + m\right) ={}\)

    \(\left(37.5 - 1.7982, 37.5 + 1.7982\right) = {}\)

    \(\left(35.7018, 39.2982\right)\).

We are \(95\)% confident that the interval \(\left(35.7018\text{ mm}, 39.2982\text{ mm}\right)\) contains the mean length of all the zebra mussels in the lake.

Example

The length of zebra mussels in certain lake in northern Michigan was previously modeled using a normal distribution with mean 39.2 mm. In an attempt to control the zebra mussel infestation, native crayfish was introduced into the lake. Two years later, researchers collected measurements of 64 zebra mussels from the lake. The mean length of their sample was 31.8 mm, with standard deviation 6.1 mm. Use this data to test the original model at 5% significance level.

  • \(H_0\colon \mu = 39.2\) mm
  • \(H_A\colon \mu \neq 39.2\) mm
  • \(\alpha = 0.05\)
  • Sample:
    • \(n = 64\)
    • \(\overline{x} = 31.8\) mm
    • \(s = 6.1\) mm
  • \(\displaystyle t = \frac{\overline{x} - \mu}{s/\sqrt{n}} = \frac{31.8 - 39.2}{6.1/8}\)

    \({} = -9.704918\)

  • Two-tailed \(p\)-value with negative \(t\):

    2 * pt(-9.7, df = 63)
    [1] 4.055363e-14

We have sufficient evidence to reject \(H_0\) at 5% significance level.

Example (Exercise 19)

Suppose an investigator takes a random sample of \(n = 50\) birth weights from several teaching hospitals located in an inner-city neighborhood. In her random sample, the sample mean \(\overline{x}\) is 3,150 grams and the standard deviation is 250 grams.

  • Calculate a 95% confidence interval for the population mean birth weight in these hospitals.
  • The typical weight of a baby at birth for the US population is 3,250 grams. The investigator suspects that the birth weights of babies in these teaching hospitals is different from 3,250 grams, but she is not sure if it is smaller or larger. Carry out the hypothesis test that she would conduct.

Example (Exercise 20 part a)

In a study on gifted children, the researchers collected data on the mother’s and father’s IQ of the 36 randomly sampled gifted children. The histogram below shows the distribution of mother’s IQ. Also provided are some sample statistics.

  • \(n = 36\)
  • \(\text{min} = 101\)
  • \(\overline{x} = 118.2\)
  • \(s = 6.5\)
  • \(\text{max} = 131\)

Perform a hypothesis test to evaluate if these data provide convincing evidence that the average IQ of mothers of gifted children is different from the average IQ for the population at large, which is 100. Use a significance level of 0.10.

Experimenting with errors

Look at the YRBSS data set again:

library(oibiostat)
data(yrbss)
favstats(~height, data = yrbss)
  min  Q1 median   Q3  max     mean        sd     n missing
 1.27 1.6   1.68 1.78 2.11 1.691241 0.1046973 12579    1004

Test the (true) null hypothesis \(H_0: \mu = 1.691241\) with alternative \(H_0: \mu \neq 1.691241\).

Use sample size \(n = 25\).

Then test various false null hypotheses with different sample sizes.