STAT 135 (Intro to Stats via Modeling): CPS data

Author

XX INSERT NAMES HERE

Published

2026-01-29

Instructions

In groups of three, your task is to generate a multivariate visualization of the CPS85 dataset that tells a story. We are looking for three or four variables being displayed in a scatterplot. The Current Population Survey is conducted by the US Census Bureau and the US Bureau of Labor Statistics.

The person whose birthday comes up next will be the leader. The person whose birthday comes up next after that will be the scribe. The third person will be the expert on the CPS85 data.

The data are available within the mosaicData package.

  1. At the console, run the commands library(mosaic) and library(tidyverse).
  2. Then you can run the commands ?CPS85 and glimpse(CPS85) to get a sense for what this dataset contains.
  3. Next, start exploring the dataset using plots, tables, and other numeric summaries. You should use the mplot(CPS85) command.
  4. This will display a SETTINGS wheel. If you click it you should see a menu.
  5. Please select ggplot2 as your graphics system.
  6. Begin by selecting variables for X and Y axes.
  7. Next you can overlay plots (using color with a categorical variable) and stratifying (using facets and a different categorical variables), and adding a model (e.g., line or smoother).
  8. When you click Show Expression the code to generate that figure is displayed in the console.
  9. Add these commands to this Quarto file and render it. Tell a short story (in writing) about it.
  10. When you are ready to share, Publish your results to RPubs (see board for login information).
  11. The scribe should download the completed Quarto file and share it by email with the other group members.

OUR FAVORITE PLOT

# put the code for your plot here
ggplot(data = CPS85, aes(x = age, y = wage)) + geom_point()  + aes(colour = union)  + stat_smooth(method = loess) + theme(legend.position = "right") + labs(title = "")
`geom_smooth()` using formula = 'y ~ x'

The nonunion members tend to make less money on average in their lifetime than union members. As they get into their late 60s, we see a switch in this.