Statistics 110E -- Statistical and Data Analysis-Psychology/Biological Sciences

Statistic 110 Lab 5

JMP IN Topics

  1. Pie Charts and Box Plots
  2. Scatterplots, Regression and Correlation
To illustrate the commands for Bar Graphs and Pie charts, we will use the data for exercise 6 (Chapter 9) from the homework. You will have to enter the data for the other exercises later or outside of lab.

Preliminaries for Exercise 9:6

  1. Start up JMP IN (Go to the START menu => Programs => Statistics and Mathematics Programs. and then select JMP IN. The program should start with a blank spread sheet "Untitled 1". We will
  2. Double-Click on "0 Rows" in the upper left corner of the spreadsheet. In the Pop-Up window, specify the number of rows to add, 6. Click on Add or simply hit Enter.
  3. Enter the 6 numbers for the year 1960 in Column 1 of the spread sheet. You may rename the column by highlighting the text with the mouse, and then replacing the text with a new name, say "1960".
  4. To add another column, go to the Cols menu and select "New Column...". Specify the name and then click on . Add a column and enter the data for the other 2 years, 1980 and 1990.
  5. To add a column for a categorical variable, go to the Cols menu and select "New Column...". Enter the Col Name: "Kids Live With". In the Data Type field, select "Character". If you give the full category names, you will need to also increase the Field Width to 21. I would recommend using shorter abbreviations for the graph, i.e. "FM", "MO", "FO", etc. Click "OK", and then enter the data in the spreadsheet. To see all of the names you may need to widen the column on the screen. Position the mouse on the vertical line on the right side of the column. When the cursor changes to a cross with horizontal arrows, click and drag the mouse to widen the column. (To enlarge the window, click in the lower right corner and drag to enlarge.)

Pie Charts and Bar Graphs

  1. Go to the Graph menu at the top of the JMP IN screen, and select Bar/Pie Charts
  2. Specify the categorical variable "Kids Live With" as the X variable, by clicking on "Kids Live With", and then clicking >> X >>
  3. Specify the 3 percentages for the years 1960, 1980 and 1990 as the >> Y >> variables. Now click on OK .
  4. A window should appear, with 3 bar graphs, one for each year.
  5. You can resize the graph by clicking inside the graph. A small square will appear in the lower right corner. If you click inside of this box, you can then drag the mouse to resize the graph.
  6. To switch to pie charts, click on the "Check" on the lower left of the output window, and select "Pie". To go back to Bar Graphs, click on the "Check" and select "Horizontal" or "Vertical.
  7. To have the three years in the same Bar Graph, go to the "Check" menu, and select "Overlay". (again follow the instructions above to resize the graph if necessary).
  8. To add a "Title", click on the "*" button on the lower left of the output window, and select "Title". In the highlighted area in the graph, enter the text for the title, "Percentage of Kids Living Parents".
  9. To add a footnote indicating the source, click on the "*" menu and select "Footnote". Add the appropriate text "Source: ...." in the highlighted area of the graph.
  10. Save the output to a "journal file". Go to the Edit Menu, then select Journal. Make sure that the journal window is in the foreground (the title bar is highlighted). To save it select, "Save as" under the file menu. This can be imported into other programs, such as Word-Pad, where you can add additional information such as what the category labels mean, delete any extraneous information, change fonts, resize "objects" and make sure that the graphic has all of the features of a good statistical picture!
  11. To save your data, make sure that the spreadsheet window is selected, (click on the top of the window to bring it to the foreground) and then go to the File menu and select "Save as". Make sure you save data and output to your own disk!

To illustrate scatter plots and line graphs, we use the data from chapter 11 exercise 4.

Preliminaries for Exercise 11:4

Enter the data in the spreadsheet for the 8 observations, using numerical variables for the "Experts' Rank" and "Students' Rank", and a categorical variable for "Activity" (You should have 3 columns).

Scatter Plots and Line Graphs

  1. To create a line graph or scatter plot, go to the Graph menu and select Overlay Plot .
  2. In the Pop-up window, specify the X and Y variables. Specify "Activity" as a LBL (Label) variable, then click on Plot.
  3. By default, the graph appears as a line graph. To change to a scatter plot, Click on the arrow at the bottom of the plot next to "Students' Rank (or the name of the Y-variable), and then click on "Connect" to toggle off the line connecting the points.
  4. To identify labels for points, just click on the point.
  5. To change the symbol and/or colors for all points. Go to the Row menu, and click on "Select.." and the " All Rows". Under the Row menu, select Colors or Markers to change the color and symbol of plotted points. When all rows are selected, you can also click on "Label/Unlabel" under the row menu to label all points.
  6. Be sure to add an informative title and footnote for the source. Save to a journal file and clean up as needed using Word-pad or another program.

Scatterplots and Regression

Here is a second way to get a scatter plot (as well as the regression line and correlation)
  1. Go to the Analyze menu and select Fit Y by X
  2. Specify the variable for the X axis (Experts' Ranking) and the Y-axis (Students' Ranking). Select "Activity" as the label variable.
  3. To get the regression line, Click on the arrow next to "Fitting" at the bottom left of the window; select "Linear Fit".
  4. Note: The correlation between Y and X is the sqrt of the R-square value times the sign of the slope.
  5. For part b, to check your intuition exclude points (rows) and refit the regression to get the new correlation. To exclude points, select a row(s) in the spreadsheet. Go to the Rows menu and click on "Exclude/Include". You should see a "Null" symbol next to the row number if it is excluded. Then go to the Analyze menu and refit the regression as in steps 1 and 2. The new correlation is the square root of the R-Squared value in the new output window.
  6. To include the excluded point, go to the Row menu and select "Exclude/Include". The null symbol should disappear.
  7. For part c, to check your intuition add a new row with the new data. Double click on the "8 Rows" or use the "Rows" menu to add a new row. Enter the new observations for each column, and then refit to see if the correlation changes as you would expect.
  8. Be sure to add an informative title and footnote for the source. Save to a journal file and clean up as needed using Word-pad or another program. Exclude any material that is not relevant!

Correlations

To get only correlations between measurement variables, go to the Analyze menu and select Correlation of Y's. Specify both ranking variables as Y's and then click OK. Note the output is in a table of correlations between each pair of variables; the correlation between any variable and itself is always 1. The correlation between the Experts' Ranking and the Students' Ranking is 0.4072. Using the same technique above, you can exclude rows and and recalculate the correlations. The results should agree with the square roots of the R-Square values times the sign of the slope.