OpenIntro Example: Scatterplot of Federal Spending Versus Poverty Rate

In the Open Intro Textbook Advanced High School Statistics, a scatterplot is created with the county dataset with poverty as the independent variable and fed_spend as the dependent variable. How does one recreate this plot in Quadstat, R and SAS?

To recreate this plot, use the Bivariate Plot web application. We will want to select county from the dropdown select as shown here.

Bivariate Plot Statistics Quadstat Screenshot

We will also need to select two columns. Use the mouse to highlight a column header. The first column chosen will be the independent variable. Once a column is highlighted, it will appear with a shaded background.

Quadstat Statistics Highlighted Column Screenshot

Once both columns are select, click "Submit". The browser will be redirected to a page with the bivariate scatterplot (the same shown on page 14 of the OpenIntro Textbook Advanced High School Statistics.)

Quadstat Statistics Bivariate Scatterplot Screenshot

R Code


X <- read.table("/home/ubuntu/county.txt", sep="\t", header = TRUE);
plot(X)

SAS Code


/* Generated Code (IMPORT) */
/* Source File: county.txt */
/* Source Path: /folders/myshortcuts/Quadstat */
/* Code generated on: 5/29/17, 11:17 AM */
%web_drop_table(WORK.COUNTY);
FILENAME COUNTY '/folders/myshortcuts/Quadstat/county.txt';
PROC IMPORT DATAFILE=COUNTY
DBMS=DLM
OUT=WORK.COUNTY;
DELIMITER='09'x;
GETNAMES=YES;
RUN;
PROC CONTENTS DATA=WORK.COUNTY; RUN;
%web_open_table(WORK.COUNTY);

The statistician will want to make sure place county.txt file in the SAS VirtualBox folder created and also rename the path to county.txt.

This line in the code above is to set the delimiter as the TAB character which in SAS is represented as '09'x.

DELIMITER='09'x;