Learn By Doing – Scatterplots (Software)

Published: December 24th, 2012

Category: Activity 1: Learn By Doing, Learning Statistical Software

Use the solutions provided and complete the questions for practice with Case Q-Q.

Optional: Create your own solutions using your software for extra practice.

Objectives:

  • Create and interpret a simple scatterplot
  • Create and interpret a labeled scatterplot

Solutions:

Use the following output to answer the questions that follow.

Background Information for Dataset

In this activity we will look at height and weight data that were collected from 57 males and 24 females, and use the data to explore how the weight of a person is related to (or affected by) his or her height. This implies that height will be our explanatory variable and weight will be our response variable. We will then look at gender, and see how labeling this third variable contributes to our understanding of the form of the relationship.

Our dataset contains the following variables:

  • gender: 0 = male, 1 = female.
  • height: in inches.
  • weight: in pounds.

Data:

height.xls or height.csv


Learn By Doing

Answer the following questions using the output obtained. In this exercise we will:

  • use the scatterplot to examine the relationship between two quantitative variables.
  • use the labeled scatterplot to better understand the form of a relationship.

http://phhp-faculty-cantrell.sites.medinfo.ufl.edu/files/2012/07/qz-LBD02014.swf

http://phhp-faculty-cantrell.sites.medinfo.ufl.edu/files/2012/07/qz-LBD02015.swf


(Optional) SPSS Steps:

  • Import Data: FILE > OPEN > DATA, choose Excel file from the pull-down, find the file, continue
  • Define Variable Properties: Provide labels for 0 and 1 as Male and Female, and label
    • Height: label as “Height (inches)
    • Weight: label as “Weight (pounds)
  • Scatterplots: GRAPHS > CHART BUILDER, complete the wizard for each of the two requested graphs. Edit colors for males and females on the labeled scatterplot.

(Optional) SAS Steps:

  • Create FORMATS for Gender: Use PROC FORMAT to create a format to translate 1 into “Female” and 0 into “Male” (we will associate it with the variable in the next step).
  • Label and Format Variables: Using a DATA step, create a new dataset named height2 where you label the variables height and weight as Height (inches) and Weight (pounds) using a LABEL statement. Use a format statement to format the variable gender with the format created in the previous step.
  • View Dataset Information in SAS: Use PROC CONTENTS to view the information about the new dataset.
  • Create Basic Scatterplot: Use PROC SGPLOT and the SCATTER statement to create a scatterplot of X=height by Y=weight
  • Create Labeled Scatterplot: Use PROC SGPLOT and the SCATTER statement to create a scatterplot of X=height by Y=weight with the GROUP= option to label the points by gender.

This document is linked from Scatterplots.