1.0 SPSS commands used in this unit
descriptives | procedure for obtaining means, standard deviations, etc. |
compute | creates new numeric variables |
split file | organizes output by a categorical variable |
filter | excludes certain cases from the analysis |
use all | uses all cases in the data set |
means | calculates means for different groups |
examine | procedure for obtaining descriptive statistics |
graph | general procedure for creating graphs |
frequencies | calculates frequencies |
crosstabs | calculates crosstabulations |
correlations | calculates correlations |
2.0 Demonstration and explanation
In this unit we will explore our data set. By "explore", we mean conduct some descriptive statistics on variables that will be important to the analysis that we plan to run. This exploration is very important, because it allows us to become familiar with our data. Also, this there are any problems with the data, such as out-of-range values, etc., we can discover them.
Let’s begin by opening the data file.
* open the data file. get file "c:spss_datahs0.sav".
We will begin by getting the descriptive statistics for some of the variables.
* descriptives for some of the variables. descriptives variables=gender read write math science.
We can organize the output by the levels of a categorical variable sorting on that variable and then splitting the file.
* organize the output by a categorical variable. sort cases by ses. split file by ses. descriptives variables = gender read write math science. split file off.
Now we will do the same thing, but we will only look at that the records for students who earned reading scores of 60 or above.
* create a filter for reading scores 60 * and above and recompute the * descriptive statistics. compute f_read60=(read >= 60). filter by f_read60. execute.descriptives variables=gender read write math science.
For the next example, we will select a different set of cases to be analyzed. We will begin by using all of the cases, and then providing the selection criteria.
* after removing the previous filter * (with the "use all" command), create * a new filter and recompute the * descriptive statistics. use all.compute f_acad=(prgtype="academic"). filter by f_acad. execute.descriptives variables=gender read write math science.
Instead of selecting cases based on the value of a variable, we will now look at cases that fall into a range. As before, we will start by resetting the selection criteria to include all cases. Next, we will specify the range of cases that we want included in the analysis.
* after removing the previous filter, * select the first 40 cases. filter off.use 1 thru 40. execute.descriptives variables=gender read write math science.
Now we are going to move on to some different types of analyses. We will begin by using all of the cases in the data set. Then we will compare the means of the variables read, write, math and science broken down by prgtype.
* compare means using all cases. use all. means tables = read write math science by prgtype.
We can do some basic graphics, such as stem and leaf plots, boxplots and histograms.
* stem and leaf plot. examine variables = write /plot stemleaf.* boxplot. examine variables = write by gender /plot = boxplot /statistics = none.* histogram. graph /histogram(normal) = write.* histogram. frequencies variables = ses /histogram.frequencies variables = write /histogram.
Now we will look at some crosstabulations and correlations.
* crosstabs. crosstabs /tables = prgtype by ses.* correlations. correlations /variables=read write math science.* changing from casewise to listwise deletion of missing data. correlations /variables=read write math science /missing=listwise.
Let’s do some more graphics. The graphical representation of a correlation is a scatterplot, so let’s try a couple of those.
* scatterplot. graph /scatterplot = read with write.* scatterplot matrix. graph /scatterplot(matrix) = read write math science.
3.0 For more information
- SPSS Frequently Asked Questions
How can I do a scatterplot with regression line in SPSS?
How can I graph two (or more) groups using different symbols?
How can I display overlapping data points on a scatterplot?
How do I interpret the results from crosstabs?