SPSS commands

0.1 Notes on homework format

  • Submit each homework as as single PDF through NYU classes. Write the SPSS report in word. Take a picture of your manual calculations and add them at the end of the file.
  • To include SPSS table outputs in your word file, you need to bring results from virtual computer lab to your own computer. Simple copy+paste does not work. My suggestion is that you take a screen shot of your results and copy it to your word document.
  • Main suggestion: follow professor Hassad’s homework template closely. The templates vary a bit from homework to homework, so make sure to follow the template for the current homework assignment. It is fine to use the wording on the template, but, of course, make sure to adjust the reasoning for your own results.

0.2 Data visualization: data at the nominal level (categorical variables in SPSS)

Frequency tables

Frequency table: Analyze > Descriptive Statistics > Frequencies > Move variable of interest into the box > Click OK.

Note: the “valid percent” column accounts for missing data.

Bar charts

Bar graphs of frequency distribution: Graphs > Legacy Dialog > Bar > Define > Move variables into the category axis box > Click OK.

0.3 Data visualization: data at the ordinal, interval and ratio levels (continuous variables in SPSS)

Histograms

Bar graphs of frequency distribution: Analyze > Descriptive Statistics > Frequencies > Move variable of interest into the box > Click OK.

See a problem? For data measured at ordinal, interval and ratio levels, those tables are often not very useful. We need other forms of data visualization.

Histograms of frequency distribution: Graphs > Legacy Dialogs > Histogram > Move the variable into the “variable box” > Click OK.

We can edit our histogram:

Alter number of bins: Double click on the graph > Chart editor view will open > Double click on the bars > Properties > Scale > Select binning tab > custom > Modify values > Click OK.

Alter y-axis to percentages Double click on the graph > Chart editor view will open > Double click on “frequency” > Properties > Variables tab1 > Percent box > Select y-axis > Click OK.

Important: what is the difference between histograms vs bar charts?

  • Bar charts: only plot nominal data.
  • Histograms: can plot nominal, ordinal, interval and ratio data.

Why? Because we can define the range of the histogram bins.

Boxplots

Boxplot: Analyze > Descriptive Statistics > Explore > Move variable into “Dependent list” > Plots > Select options in “Box-plot” > Click OK.

5-point summary of the variable:

  • Maximum
  • Q13
  • Mean
  • Q1
  • Minimum

Note: Points outside the plot are the ones SPSS identifies as outlines. Outliers are points outside the range (Q1 - 1.5 * IQR; Q3 + 1.5 * IQR), where IQR = interquartile range (Q3 - Q1).

Stem-and-leaf table (extra)

Data: 1.3; 1.7; 1.8; 2.5; 2.9; 3.0

  • Stem width: 1
  • Each Leaf: 1 case (s)
Frequency Stem Leaf
3 1 378
2 2 59
1 3 0

Data: 13; 17; 18; 25; 29; 30

  • Stem width: 10
  • Each Leaf: 1 case (s)
Frequency Stem Leaf
3 1 378
2 2 59
1 3 0

Stem-and-leaf table: Analyze > Descriptive Statistics > Explore > Move variable into “Dependent list” > Select “Stem-and-leaf” > Click OK.

Note: select the “None” so no extra output is provided.

Line graphs (extra)

Histograms of frequency distribution: Graphs > Chart Builder > Select “Line” > Bring graph to chart preview > Bring variable to the x-axis box > Click OK.

0.4 Examining data across groups

When I say “groups”, I am referring to the different categories of categorical variables.

The split file command

Split file, compare groups: Data > Split File > Compare groups > Bring variable to the “Groups based on” box > Click OK.

Important: After doing the analysis which required the slpit file, you need to go back and undo the step above.

Cross Tabulation (extra)

Cross tabulations allow us to compare variables measured at the nominal level.

Each variable must have at least two categories.

Cross Tabs: Analyze > Descriptive Statistics > Crosstabs > Bring one or more variables to the “Rows” box > Bring one or more variables to the “Columns” box > Choose “Statistics” > Edit “Cells” and “Format” > Click OK.

0.5 Measures of central tendency and dispersion

The easiest way to get measures of central tendency in SPSS is:

Measures of central tendency: Analysis > Descriptive Statistics > Frequencies > Check mean, mode and median > Click Ok.

Another option, when looking only at one variable, is:

Measures of central tendency: Analyze > Descriptive Statistics > Explore > Move variable into “dependent list” > Select the desired statistics > Click Ok.

If we want to look at measures of central tendency across subgroups, we can do the following:

Measures of central tendency across groups: Analyze > Descriptive Statistics > Explore > Move variable into “dependent list” > Move variable with sub-groups to “factor list”" > Statistics > Select the desired statistics > Click Ok.

Measures of dispersion: Analysis > Descriptive Statistics > Frequencies > Statistics > Check variance, standard devation, range > Click Ok.

Recall that it is easier to interpret the standard deviation than it is to interpret the variance.

Skewness and kurtoiss: Analysis > Descriptive Statistics > Frequencies > Check skewness and kurtoiss > Click Ok.

0.6 Z-scores

Z-scores: Analyze > Descriptive Statistics > Descriptives > Bring the variable of interest to “Variable box” > Click on “Save Standardized Values as Variable” > Click OK > SPSS created a new variable, Zvariable_name, with the respectice z-scores.

Finding percentiles: Analyse > Descriptive Statistics > Frequencies > Bring variable to the variables box > Statistics > Percentiles > Choose value

Finding quartiles: Analyse > Descriptive Statistics > Frequencies > Bring variable to the variables box > Statistics > Quartiles.

0.7 Confidence intervals in SPSS

CIs: Analyze > Descriptive Statistics > Explore > Bring the variable of interest to “Variable box” > Statistics > Choose the CI you want > Click OK .

0.8 One sample t-test

One sample t-test: Analyze > Compare means > One sample t-test > Bring the variable of interest to “Variable box” > Choose your guess for the mean in the “Test value” box > Options > Choose the CI you want > Click OK .

When you report your SPSS results, you should add a footnote as follows:

  1. t(enter number from “df” field) = enter number from “t” field, p = (enter number from “Sig(2-tailed)” field.

0.9 Independent samples t-test

Independent samples t-test: Analyze > Compare Means > Independent sample t-test > Choose your “Test” variable > Define your “Grouping Variable” - this is just your dependent variable > Define groups (you need to tell SPSS which groups you are using in your test) > OK.

0.10 Paired t-test

Paired t-test: Analyze > Compare Means > Paired-Samples T Test > Select variables of interest (pre and post) > Ok.

0.11 One-way ANOVA

One-way ANOVA: Analyze > Compare Means > One-way ANOVA > Choose your “Dependent” variable > Define your “Factor” - this is just your categorical variable > Options > Select “homogeneity of variance test” to automatically perform the Levene’s test > Select “Means plot” > Continue > OK.

0.12 Two-way ANOVA

Two-way ANOVA: Analyze > General Linear Model Univariate > Bring the continuous variable to the Dependent Variable box > Assign the two categorical variables to the Fixed Factor(s) box > Click OK.

Other things to do to report more detailed results:

Under General Linear Model Univariate:

Plots: Click on Plots > Bring one of your categorical variables to Horizontal Axis (usually you should bring the variable with the most categories here) > Bring the other categorical variable to Separate Lines > Add > Continue.

Post Hoc: Click on Post Hoc > Bring your categorical variable (only the ones with more than 2 categories) to “Post Hoc Test for” > Continue.

Levene’s Test: Options > Homegeneity tests > Continue

0.13 Correlation

Scatter plots Graphs > Legacy Dialogs > Scatter/Dot > Click on Simple Scatter > Define > Move variables to Y and X boxes > Click ok.

Pearson’s correlation coefficient: Analyze > Correlate > Bivariate > Select the Pearson correlation coefficient > Select the two-tailed test of significance > Also select flag significant correlations > Click Ok.

0.14 Simple linear regression

Simple linear regression: Analyze > Regression > Linear > Select your dependent and independent variables > Click ok

Note that your dependent variable must be continuous.

When you report your SPSS results, you should add a footnote as follows:

  1. Dependent Variable:
  2. Model Significance: F(df-regression,df-residual) = F-value, p = p-value
  3. R-squared = R-value

0.15 Chi-Squared

Chi-Squared Test of Independence: Analyze > Descriptive Statistics > Crosstabs.