Group Tasks

The group tasks in this lab will not be assessed, however they do offer good practise into writing your own code in R.

Pregnancies Questions

In 2004, the state of North Carolina released a large data set containing information on births recorded in this state. This data set is useful to researchers studying the relation between habits and practices of expectant mothers and the birth of their children. We will work with a random sample of observations from this data set.

Load the nc data set into your workspace by typing the following code in an Rscript file in your local Rstudio.

download.file("http://www.openintro.org/stat/data/nc.RData", destfile = "nc.RData")
load("nc.RData")

Before attempting the following exercises, explore the data as much or as little as you like using code from this Lab.


Task 1

Calculate a 95% confidence interval for the average length of pregnancies (weeks). Note that since you’re doing inference on a single population parameter, there is no explanatory variable.


Complete the following sentence, giving your answers to 2 decimal places. We are 95% certain that the average length of pregnancy for the population of women is between and weeks.


Task 2

Calculate a new confidence interval for the same parameter at the 90% confidence level.


Complete the following sentence, giving your answers to 2 decimal places. We are 90% certain that the average length of pregnancy for the population of women is between and weeks.


Task 3

Conduct a hypothesis test evaluating whether the average weight gained by younger mothers is different than the average weight gained by mature mothers.

Hint Create a 95% confidence interval for the difference in mean weight gained between the two age groups. Don't forget to calculate a new standard error to use.


What are your conclusions from this hypothesis test?

  1. Given that the confidence interval contains 0, we reject the null hypothesis and conclude that there is a statistically significant difference in weight gained between younger and mature mothers in the population.

  2. Given that the confidence interval does not contain 0, we reject the null hypothesis and conclude that there is a statistically significant difference in weight gained between younger and mature mothers in the population.

  3. Given that the confidence interval does not contain 0, we do not reject the null hypothesis and conclude that there is no statistically significant difference in weight gained between younger and mature mothers in the population.

  4. Given that the confidence interval contains 0, we do not reject the null hypothesis and conclude that there is no statistically significant difference in weight gained between younger and mature mothers in the population.


Task 4

Create side-by-side boxplots of the mothers' age (mage) for the two group; "mature mom" and "younger mom".


Based on these boxplots, what would you say the age cutoff for a mother to be classified as a "younger mom" is?

  1. 25

  2. 30

  3. 35

  4. 40