Other Computer Solutions for Chapter 4 SPSS. After accessing the

Other Computer Solutions for Chapter 4
SPSS. After accessing the SPSS data file, the following steps could be used to replicate the
analyses shown in R. First, it would be necessary to split the file by “race,” as we showed you how to do
at the end of Chapter 3. After splitting the file, you will want follow the sequence of steps as detailed
Descriptive Statistics
Move WKMOMED to the Variable(s): Box
Click OK
We might want SPSS to produce bar charts for the two distributions. We could do that for each group
separately, or we could use the “clustered” option. For example,
Click Clustered
Click Define
Move Race to Category Axis: box
Move WKMOMED to Define Clusters by: box
Click OK
Note that, contrary to recommended practice, SPSS does not put spaces between the bars.
Although this doesn’t change the information in any way, it’s important to be cognizant of the fact that
your data are still categorical (despite the fact that the bars are touching). In addition to bar charts, we
might want to produce pie charts. To do this, we would first need to split the file as before. Then we
would follow the sequence
Move WKMOMED to Define Slices by: box
Click OK
SAS. After reading the data, the following syntax could be used in SAS to replicate the analyses
shown in R and SPSS. In particular, the frequency distribution of mother’s educational level for both
White and African American students is created using Proc Freq. Then Proc Gchart is used with the Vbar
Statement to create a bar chart of mother’s educational level for each race. Finally, the pie charts are
created using Proc Gchart with a Pie Statement.
libname c 'c:\documents and settings\desktop\courses\';
data one;
set c.ecls;
proc sort;
by race;
proc freq;
tables wkmomed;
by race;
proc gchart;
vbar wkmomed;
by race;
proc gchart;
pie wkmomed;
by race;
To compute the index of dispersion, we had to write a little extra code. The only line you would
need to ever change is the second line.) This line lists the number of cases for each group of the family
type variable for White children from our example. Where we have {90 8 2 0 0}, you would place in
brackets whatever group sizes you were working with. If you then click the running person, SAS will
print the index of dispersion.
proc iml;
groupsizes={90 8 2 0 0};
do i=1 to c;
sum = sum + groupsizes[1,i]**2;
dispersion=c*(n**2 - sum)/((n**2)*(c-1));
print dispersion;