mat152 lab 4

6
Lab 4 – Quantitative Data Presentation The objectives of this lab are to Load data in to SPSS from an Excel file, present information on a quantitative variable by using a: o Histogram, o Grouped frequency table, o Stem leaf plot, o Dot plot These topics are covered in section 2.2 of the text. Lab practice: Load data from an Excel file Start SPSS. From the Data Editor window, click on File – Open – Data In the Look in: box at the top, click the down arrow on the list box and select labshare on ‘nf3-central.cpcc.edu’ (L:). Double click on the Mathematics folder, then on the MAT152 folder. For an Excel file, at the bottom of the Open Data window is a list box labeled Files of type. Choose Excel from the list. Click on Pulses Excel Format.xlsx, then on Open. The Opening Excel Data Source window now gives you the option to use the first row of the spreadsheet (which frequently will be column headings) as variable names. That’s the case with this file, so be sure that box is checked. Note that you can also specify which worksheet in the Excel file to open, as well as the range of cells to be opened. The choices shown for those options work fine for this file. Click on OK. You’ll see the results in a new Data Editor window. Quantitative Data Presentation Histogram o In the Data Editor window, click on Analyze – Descriptive Statistics – Frequencies . o Select Pulse for the variable to be analyzed (use the arrow in the middle of the window to move Pulse into the Variable list). o Click on Charts, select Histograms, then click on Continue. o Be sure that the option to Display frequency tables is checked, then click OK. The results will be displayed in the Output window. o In the Output window, notice that the frequency table is rather long – one row in the table for each individual observation. We’ll create a grouped table in the next part of the lab. o Still in the Output window, double click on the histogram, which will open a window for the Chart Editor. Change the title to say XXX’s Pulse Rate Histogram. o Still in the Chart Editor, notice that SPSS has automatically determined the class intervals to use for the bars of the histogram (SPSS refers to those as ‘bins’, and the process of creating them as ‘binning’). We do want to use intervals for the histogram, just not the ones that SPSS automatically determines. Click on Options – Un-bin Element. This will remove the automatically generated intervals, and show a bar for each value for pulse rate. o To create our own intervals, click on Options – Bin Element, which will open a Properties window on the Binning tab. Under the X-Axis section, select Custom, specify 7 for the Number of intervals, then click Apply.

Upload: vishal-naik

Post on 18-Jan-2016

12 views

Category:

Documents


0 download

DESCRIPTION

Statistics lab 4 CPCC

TRANSCRIPT

Page 1: Mat152 Lab 4

Lab 4 – Quantitative Data Presentation

The objectives of this lab are to

Load data in to SPSS from an Excel file,

present information on a quantitative variable by using a:

o Histogram,

o Grouped frequency table,

o Stem leaf plot,

o Dot plot

These topics are covered in section 2.2 of the text.

Lab practice: Load data from an Excel file

Start SPSS.

From the Data Editor window, click on File – Open – Data

In the Look in: box at the top, click the down arrow on the list box and select labshare on ‘nf3-central.cpcc.edu’

(L:).

Double click on the Mathematics folder, then on the MAT152 folder.

For an Excel file, at the bottom of the Open Data window is a list box labeled Files of type. Choose Excel from

the list. Click on Pulses Excel Format.xlsx, then on Open.

The Opening Excel Data Source window now gives you the option to use the first row of the spreadsheet (which

frequently will be column headings) as variable names. That’s the case with this file, so be sure that box is

checked. Note that you can also specify which worksheet in the Excel file to open, as well as the range of cells to

be opened. The choices shown for those options work fine for this file. Click on OK. You’ll see the results in a

new Data Editor window.

Quantitative Data Presentation

Histogram

o In the Data Editor window, click on Analyze – Descriptive Statistics – Frequencies .

o Select Pulse for the variable to be analyzed (use the arrow in the middle of the window to move Pulse

into the Variable list).

o Click on Charts, select Histograms, then click on Continue.

o Be sure that the option to Display frequency tables is checked, then click OK. The results will be

displayed in the Output window.

o In the Output window, notice that the frequency table is rather long – one row in the table for each

individual observation. We’ll create a grouped table in the next part of the lab.

o Still in the Output window, double click on the histogram, which will open a window for the Chart

Editor. Change the title to say XXX’s Pulse Rate Histogram.

o Still in the Chart Editor, notice that SPSS has automatically determined the class intervals to use for the

bars of the histogram (SPSS refers to those as ‘bins’, and the process of creating them as ‘binning’). We

do want to use intervals for the histogram, just not the ones that SPSS automatically determines. Click

on Options – Un-bin Element. This will remove the automatically generated intervals, and show a bar

for each value for pulse rate.

o To create our own intervals, click on Options – Bin Element, which will open a Properties window on the

Binning tab. Under the X-Axis section, select Custom, specify 7 for the Number of intervals, then click

Apply.

Page 2: Mat152 Lab 4

o Close the Properties window and the Chart Editor. Verify that the Output window has the changes you

made to the histogram.

Grouped frequency table

We noticed earlier that the frequency table in the Output window had a row for each value for pulse, which

made the table rather long. In this part of the lab, we will create a grouped frequency table using binning. To

get started, from the Data Editor window click on Transform – Visual Binning.

o Make sure Pulse is highlighted,

o click the arrow in the middle to move it to the Variables to Bin list,

o then click Continue.

You should see a window like this one:

o For the Name of the Binned Variable, enter PulseClass (that’s all one word, no blanks). Notice it shows

the minimum (43) and maximum (110) values in the dataset. With those in mind, click on Make

Cutpoints (a cutpoint is the boundary between two adjacent classes).

o In the top section for Equal Width Intervals,

enter 42 as the First Cutpoint Location (a value just below the minimum so that the smallest

value is included in the first interval), and

7 for the Number of Cutpoints. Press the Tab key after entering the number of cutpoints, and

notice the class width and location of the last cutpoint that SPSS has calculated, then click on

Apply.

In the grid on the lower half of the Visual Binning window, SPSS shows the locations for all of the cutpoints it has

generated. Next, click on

Make Labels to generate the labels that describe each class. Finally,

click on OK,

then on OK again to the informational message that 1 variable will be created.

Page 3: Mat152 Lab 4

Notice that the Data Editor window now has a third variable named PulseClass, indicating which

class that observation belongs to. View the Value Labels, and notice the class interval descriptions

that were created by the Make Labels option.

o Now we’re ready to create the grouped frequency table. From the Data Editor window, click on Analyze

– Descriptive Statistics – Frequencies.

Click on Pulse in the Variables list and use the arrow in the middle of the window to remove it

from the list. Then

highlight Pulse (Binned) and move it to the Variables list.

Be sure that Display frequency tables is checked,

then click on OK.

Check the Output window to view the grouped frequency table. If the Histogram option was still

checked under the Charts button, you’ll also see a histogram based on the grouped frequency table.

Stem-leaf plot

o From the Data Editor window, click on Analyze – Descriptive Statistics – Explore (the stem-leaf plot is

classified as part of exploratory data analysis).

o Highlight Pulse, and move it to the Dependent List.

o Click on the Plots… button near the upper right of the Explore window.

o Set Boxplots to None (we’ll cover that in a later lab), and

o select the Stem-and-leaf option.

o Leave the Histogram option unchecked, since we’ve already done that part.

o Click on Continue, which will close the Plots window.

o In the Display area at the bottom of the Explore window, select Plots,

o then OK to run the stem-leaf plot. Check the Output window to review the results.

Dot plot

To create the dot plot, from the Data Editor click on Graphs – Chart Builder. If you get a message reminding

you to make sure the measurement level is set properly for each variable, click on OK. (You may also want

to check the box to not show the message again.) The Chart Builder window looks like this:

Page 4: Mat152 Lab 4

o In the Gallery at the lower left,

click on Scatter/Dot, then

select the Simple Dot Plot (the second entry on the second row), and drag it to the preview area

at the top right of the window.

At the upper left, click on the Pulse variable, and drag it to the X-axis? area in the preview area,

Then click on OK to create the plot.

Review the results in the Output window.

o Notice that there isn’t one dot for each observation – SPSS has grouped the data. To get one dot for

each observation, double click on the dot plot to activate the Chart Editor.

Click on one of the dots in the dot plot so that all of the dots are highlighted,

then on Edit – Properties.

Click on the Binning tab in the Properties window.

In the X-Axis area, click on Custom and specify an Interval width of 1.

Click on Apply to see the results.

Page 5: Mat152 Lab 4

o The markers (circles) for the dots are a little big.

On the Marker tab in the Properties window, set the marker size to 8.

In the Color area, click on Fill, and select a color to make the markers look like dots rather than

circles.

Then click Apply, and

close the Properties window.

o The dot plot doesn’t have a title, so in Chart Editor click on Options – Title, and give it a title of XXX’s

Dot Plot of Pulses. Close the Chart Editor.

Export the output window to a file

From the Output window, click on File – Export.

Click the down arrow for Type:. Select the option for Portable Document Format (*.pdf). Leave the Options as

they are shown.

Click the Browse… button, which will display the Save File window. Do not click the Browse button multiple

times. That has been known to lock up your SPSS session. If that happens, you’ll have to end your SPSS session

from Windows Task Manager. That will close all of your SPSS windows, and will discard any work that you’ve

done, meaning that you’ll have to restart the lab from the beginning.

In the Look in: box at the top of the window, choose the MAT152 Labs folder you created earlier in this lab as

the location for saving the file.

File name: Name the file Lab 4 Practice xxx, where xxx are your initials.

Save as type: This option should be set to Portable Document Format (*.pdf).

Click on Save, which will return you to the Export Output window.

Click on OK at the bottom of the Export Output window to start the export (you’ll see an Exporting Progress

window while it’s working on the export).

Lab Assignment to be submitted: 1. Open the text file LabData.xlsx. It is also in the MAT152 folder on the labshare (L) drive. The first row of the

spreadsheet has column headings, which are to be used for the variable names.

2. For the variable income, create a:

a. Histogram

b. Grouped frequency table with 8 classes (use IncClass as the binned variable name)

c. Histogram based on the grouped frequency table, rather than on SPSS defaults

d. Stem leaf plot

e. Dot plot

Be sure to put meaningful titles all charts.

3. Export the SPSS output window in PDF format as Lab 4 Assignment xxx, where xxx are your initials.

To save your work to be continued later:

1. At the end of the first session, Save (do not export) the current output by clicking the Output window, then on

File – Save As. Be sure to give it a meaningful name. This will save the output file with a .spv name. Be sure to

save it in your MAT152 Labs folder.

2. Later, start SPSS, then open the saved output file first. From Data Editor, File – Open – Output, then select the

file from your MAT152 Labs folder.

3. Once the Output window is opened, then open the data file and continue the lab. Any new output generated

will be appended to the end of the original output file.

4. When you’ve completed the lab, Export the contents of the Output window as usual.

Page 6: Mat152 Lab 4

Submit output to instructor

In the Lab 4 Assignment from our Blackboard course,

click on the Browse My Computer button next Attach File, and

go to the MAT152 Labs folder where you saved your output.

Select Lab 4 Assignment xxx.pdf , and click on Open.

Finally, click on the Submit button at the lower right of the screen to submit your lab work.

This completes the work for Lab 4. Close all SPSS windows and log off Blackboard. Do not save the Output window

contents, since you just exported it. Please remember to log off the computer before you leave.