1 of 20

API CAN CODE �Data Science Practices

Lesson 3.4: Graphs and Figures for Two Variables

This work was made possible through generous support from the National Science Foundation (Award # 2141655).

2 of 20

Warmup

  • Examine the graph to the right.�
  • What kind of graph is this?�
  • What variable(s) do you see represented? Is there more �than one? �
  • What do you notice? �What do you wonder?�
  • What story does this graph portray?

2

3 of 20

Lesson 3.3 Recap

  • We learned about using CODAP to create data visualizations in one variable

  • These visualizations included dotplots, histograms, and boxplots for quantitative variables
  • We also talked about using bar graphs to show the distribution of a qualitative variable
  • Today, we’ll hone in on graphs and figures for two variables

3

4 of 20

Roller Coasters - CODAP Dataset

  • Open the Roller Coasters example in CODAP.
    • What kind of data is this?
    • What’s going on in this dataset?
    • What do you notice? What do you wonder?

4

5 of 20

Creating a Scatter Plot

  • Create a graph with Max Height on the x-axis and Top Speed on the y-axis. This creates a scatter plot.
    • How would you describe the relationship between these variables based on the graph?

5

6 of 20

Describing a Scatter Plot

  • Scatter plot features:
    • What is the direction (positive or negative)?
    • What is the form (does it appear to be mostly linear, or non-linear)?
    • How strong is the relationship (is the association clear, or cloudy)?
    • Do there seem to be any major outliers?

6

7 of 20

Scatter Plots - Direction

The direction of a correlation refers to whether x and y are positively associated, negatively associated, or neither. �

  • If y increases as x increases, our direction is positive.

Hint: look for a positive �slope!�

  • If y decreases as x �increases, our direction �is negative.

Hint: negative slope!

7

8 of 20

Scatter Plots - Form

The form of an association can be either linear or non-linear.�

  • Linear associations typically look like straight lines, with either positive or negative slopes. The points usually do not fall exactly in a line, but you can imagine drawing a line through the scatter.�
  • Non-linear associations are normally curved up or down, or have a U or other shape.

8

9 of 20

Scatter Plots - Strength

The strength of a correlation refers to how clear the association is on the graph. �

  • Sometimes, this strength is quantified with r, the “correlation coefficient,” which ranges from -1 to 1�
  • An r-value near 1 indicates a strong, positive correlation�
  • An r-value near -1 indicates a strong, negative correlation

9

10 of 20

Scatter Plots - Outliers

Outliers can be harder to recognize when graphing associations. �

  • Look for points that do not fit the overall “pattern” of the graph. �
  • Points that are unusually high or low compared to the rest of the scatter of points are suspected outliers. �
  • Consider removing these points from the dataset.

10

While most of the points at x = 1.5 are around y = 15, the red point is much higher: y = 60! It does not fit the pattern and may be an outlier.

11 of 20

Roller Coasters - CODAP Dataset

  • Adding a third variable:
    • Drag the Drop, Length, Type, Year Opened, or Age Group variable onto the middle of the graph to color the points. What do you notice?

11

12 of 20

Roller Coasters - CODAP Dataset

  • Click the Ruler icon and add a Least Squares Line to the graph.
    • The equation of the Least Squares Line (aka line of best fit, or regression line) includes two numbers: 0.193 and 33.4. How do we interpret each of these numbers? (Hint: which is the slope? Which is the intercept?)
    • Does the slope make sense? Does the intercept make sense?

12

13 of 20

Roller Coasters - CODAP Dataset

  • Now, create a new graph with “Age Group” on the x-axis and “Type” on the y-axis. Note that this doesn’t create a scatter plot, but rather a two-way binned dot plot.
    • What’s different about the variables used to create this plot? Why do the dots get organized into groups instead of scattered?

13

14 of 20

Roller Coasters - CODAP Dataset

  • Click on the Ruler icon, then Show… Percent, and finally select the Row button. What does the 34% in the top right box mean?�
  • Now, go back to the Ruler icon, leave Show… Percent selected, but select “Column” instead of Row. What did the number in the top right box become? �Why did it change? �
  • Based on this data, do you see a relationship between age and type of coaster? What do you think a roller coaster built today would be made out of?

14

15 of 20

Roller Coasters - CODAP Dataset

  • Create a new graph, with Age Group on the x-axis. This time, drag Type onto the middle of the plot, which should color the points. Click the Graph icon, and check “Fuse Dots into Bars.” Then click the Graph icon again, and select Scale… Percent.
    • What information is this graph presenting? �
    • Does this make it easier to answer the question we just asked about steel vs. wooden coasters over time? �
    • How does this graph show that?

15

16 of 20

NFL Trends

  • What can you tell about this graph? (consider its direction, form, strength, and whether there are outliers).

16

17 of 20

Stephen Curry

  • What can you tell about this graph? (consider its direction, form, strength, and whether there are outliers).

17

18 of 20

GDP & Life �Expectancy

  • What can you tell about this graph? (consider its direction, form, strength, and whether there are outliers).

18

19 of 20

Exit Ticket

Describe the direction, form, and strength of this scatterplot. Are there any suspected outliers?

19

At a particular college, pre-med major percentages are summarized in the table. Do you think there is a relationship between pre-med major and year? Why or why not?

Freshm.

Sopho.

Junior

Senior

65%

40%

35%

30%

20 of 20

Thanks!

apicancode@umd.edu

20

This work was made possible through generous support from the National Science Foundation (Award # 2141655).